fix:检验表功能完善
This commit is contained in:
parent
94bd41c4f1
commit
e825947de7
|
@ -1,195 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-container>
|
|
||||||
<el-header>
|
|
||||||
<div class="left-panel">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="tableAdd" v-auth="'role.create'"></el-button>
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<div class="right-panel-search">
|
|
||||||
<el-input v-model="query.search" placeholder="检验表名称" clearable @keyup.enter="handleQuery"></el-input>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" hidePagination>
|
|
||||||
<el-table-column type="selection" width="50"></el-table-column>
|
|
||||||
<el-table-column label="#" type="index" width="50"></el-table-column>
|
|
||||||
<el-table-column label="名称" prop="name" min-width="100"></el-table-column>
|
|
||||||
<el-table-column label="标识" prop="code" min-width="100"></el-table-column>
|
|
||||||
<el-table-column label="描述" prop="description" min-width="150"></el-table-column>
|
|
||||||
<el-table-column label="操作" fixed="right" align="center" width="140">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link size="small" @click="roleEdit(scope.row, scope.$index)" v-auth="'role.update'" type="primary">编辑</el-button>
|
|
||||||
<el-divider direction="vertical"></el-divider>
|
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="roleDel(scope.row, scope.$index)">
|
|
||||||
<template #reference>
|
|
||||||
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</scTable>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
<el-dialog :title="titleMap[type]" v-model="limitedVisible" :width="600">
|
|
||||||
<el-form :model="addForm" :rules="rules" ref="addForm" autocomplete ="off" label-width="100px" label-position="left">
|
|
||||||
<el-form-item label="名称" prop="name" auto>
|
|
||||||
<el-input v-model="addForm.name" clearable></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="标识">
|
|
||||||
<el-input v-model="addForm.code" clearable></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="描述">
|
|
||||||
<el-input v-model="addForm.description" clearable></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="检验项">
|
|
||||||
<el-input v-model="addForm.description" clearable></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="limitedVisible=false" >取 消</el-button>
|
|
||||||
<el-button v-if="type!=='show'" type="primary" :loading="isSaving" @click="submitHandle()">保 存</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
const defaultForm = {
|
|
||||||
id:"",
|
|
||||||
name: "",
|
|
||||||
code: "",
|
|
||||||
description: "",
|
|
||||||
perms:[],
|
|
||||||
};
|
|
||||||
export default {
|
|
||||||
name: 'dept',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
apiObj:null,
|
|
||||||
selection: [],
|
|
||||||
checkList: [],
|
|
||||||
search: {
|
|
||||||
keyword: null
|
|
||||||
},
|
|
||||||
query: {},
|
|
||||||
isSaving: false,
|
|
||||||
limitedVisible : false,
|
|
||||||
checkStrictly:true,
|
|
||||||
type: "add",
|
|
||||||
titleMap: {
|
|
||||||
add: '新增',
|
|
||||||
edit: '编辑',
|
|
||||||
show: '查看'
|
|
||||||
},
|
|
||||||
|
|
||||||
//表单数据
|
|
||||||
addForm: defaultForm,
|
|
||||||
//验证规则
|
|
||||||
rules: {
|
|
||||||
name: [
|
|
||||||
{required: true, message: '请输入名称'}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
menu: {
|
|
||||||
list: [],
|
|
||||||
checked: [],
|
|
||||||
props: {
|
|
||||||
emitPath: false,
|
|
||||||
children: 'children',
|
|
||||||
// label: 'name',
|
|
||||||
/*label: (data)=>{
|
|
||||||
return data.meta.title
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getTestItem();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
//获取检验项
|
|
||||||
getTestItem(){
|
|
||||||
var res = this.$API.system.role.list.req();
|
|
||||||
this.tableData = res.results;
|
|
||||||
},
|
|
||||||
//添加检验表
|
|
||||||
tableAdd(){
|
|
||||||
this.limitedVisible = true;
|
|
||||||
this.type = "add";
|
|
||||||
this.$nextTick(()=>{
|
|
||||||
this.$refs.menu.setCheckedKeys([])
|
|
||||||
})
|
|
||||||
this.addForm = Object.assign({}, defaultForm);
|
|
||||||
},
|
|
||||||
//提交
|
|
||||||
submitHandle(){
|
|
||||||
let that = this;
|
|
||||||
this.addForm.perms = this.menu.checked;
|
|
||||||
this.$refs.addForm.validate( (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.isSaveing = true;
|
|
||||||
let res;
|
|
||||||
if(this.type==='add'){
|
|
||||||
this.$API.system.role.create.req(that.addForm).then(res=>{
|
|
||||||
this.isSaveing = false;
|
|
||||||
this.limitedVisible = false;
|
|
||||||
this.$refs.table.refresh();
|
|
||||||
}).catch(e=>{this.isSaveing = false;})
|
|
||||||
}else{
|
|
||||||
this.$API.system.role.update.req(that.addForm.id,that.addForm).then(res=>{
|
|
||||||
this.isSaveing = false;
|
|
||||||
this.limitedVisible = false;
|
|
||||||
this.$refs.table.refresh();
|
|
||||||
}).catch(e=>{this.isSaveing = false;})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//编辑检验表
|
|
||||||
roleEdit(row){
|
|
||||||
this.type='edit';
|
|
||||||
this.addForm.id=row.id;
|
|
||||||
this.addForm.name=row.name;
|
|
||||||
this.addForm.code=row.code;
|
|
||||||
this.addForm.description=row.description;
|
|
||||||
this.limitedVisible = true;
|
|
||||||
this.$nextTick(()=>{
|
|
||||||
this.$refs.menu.setCheckedKeys(row.perms)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
//删除检验表
|
|
||||||
async roleDel(row){
|
|
||||||
var id = row.id;
|
|
||||||
var res = await this.$API.system.role.delete.req(id);
|
|
||||||
if(res.err_msg){
|
|
||||||
this.$message.error(res.err_msg)
|
|
||||||
}else{
|
|
||||||
this.$refs.table.refresh();
|
|
||||||
this.$message.success("删除成功")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//表格选择后回调事件
|
|
||||||
selectionChange(selection){
|
|
||||||
this.selection = selection;
|
|
||||||
},
|
|
||||||
//搜索
|
|
||||||
handleQuery(){
|
|
||||||
this.$refs.table.queryData(this.query)
|
|
||||||
},
|
|
||||||
|
|
||||||
//本地更新数据
|
|
||||||
handleSaveSuccess(data, type){
|
|
||||||
if(type=='add'){
|
|
||||||
this.$refs.table.refresh()
|
|
||||||
}else if(type=='edit'){
|
|
||||||
this.$refs.table.refresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;}
|
|
||||||
</style>
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="left-panel">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="tableAdd" v-auth="'qct.create'"></el-button>
|
||||||
|
</div>
|
||||||
|
<div class="right-panel">
|
||||||
|
<div class="right-panel-search">
|
||||||
|
<el-input v-model="query.search" placeholder="检验表名称" clearable @keyup.enter="handleQuery"></el-input>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<scTable ref="table" :apiObj="apiObj" row-key="id">
|
||||||
|
<el-table-column type="selection" width="50"></el-table-column>
|
||||||
|
<el-table-column label="#" type="index" width="50"></el-table-column>
|
||||||
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="编号" prop="number"></el-table-column>
|
||||||
|
<el-table-column label="检测类型" prop="description" min-width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-for="(item,index) in scope.row.tags" :key="item">{{ tags_[item] }} <span v-if="index < scope.row.tags.length - 1">、</span></span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link size="small" @click="tableDetail(scope.row)" v-auth="'qct.update'" type="primary">详情</el-button>
|
||||||
|
<el-divider direction="vertical"></el-divider>
|
||||||
|
<el-button link size="small" @click="tableEdit(scope.row)" v-auth="'qct.update'" type="primary">编辑</el-button>
|
||||||
|
<el-divider direction="vertical"></el-divider>
|
||||||
|
<el-popconfirm title="确定删除吗?" @confirm="roleDel(scope.row, scope.$index)">
|
||||||
|
<template #reference>
|
||||||
|
<el-button link size="small" v-auth="'role.delete'" type="danger">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
<el-dialog :title="titleMap[type]" v-model="limitedVisible" @close="dialogClose" :width="600">
|
||||||
|
<el-form :model="form" :rules="rules" ref="form" autocomplete ="off" label-width="100px" label-position="left">
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="form.name" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="编号 " prop="number">
|
||||||
|
<el-input v-model="form.number" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检验类型">
|
||||||
|
<el-checkbox-group v-model="form.tags">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="item in tagsOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="limitedVisible=false" >取 消</el-button>
|
||||||
|
<el-button v-if="type!=='show'" type="primary" :loading="isSaving" @click="submitHandle()">保 存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<record-dialog
|
||||||
|
ref="showDrawer"
|
||||||
|
v-if="visibleDrawer"
|
||||||
|
:qctId="qctId"
|
||||||
|
@closed="visibleDrawer = false"
|
||||||
|
>
|
||||||
|
</record-dialog>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import recordDialog from "./qctDetail.vue";
|
||||||
|
const defaultForm = {
|
||||||
|
id:"",
|
||||||
|
name: "",
|
||||||
|
number: "",
|
||||||
|
tags:[],
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
name: 'qct',
|
||||||
|
components: {
|
||||||
|
recordDialog,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
apiObj:this.$API.qm.qct.list,
|
||||||
|
query: {search:''},
|
||||||
|
isSaving: false,
|
||||||
|
showDrawer: false,
|
||||||
|
limitedVisible: false,
|
||||||
|
visibleDrawer: false,
|
||||||
|
type: "add",
|
||||||
|
titleMap: {
|
||||||
|
add: '新增',
|
||||||
|
edit: '编辑',
|
||||||
|
show: '查看'
|
||||||
|
},
|
||||||
|
qctId:'',
|
||||||
|
//表单数据
|
||||||
|
form: defaultForm,
|
||||||
|
//验证规则
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: '请输入名称'}
|
||||||
|
],
|
||||||
|
number: [
|
||||||
|
{required: true, message: '请输入编号'}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
tagsOptions: [
|
||||||
|
{value:"purin",name:"入厂检验"},
|
||||||
|
{value:"first",name:"首件检验"},
|
||||||
|
{value:"prod",name:"成品检验"},
|
||||||
|
{value:"process",name:"过程检验"},
|
||||||
|
{value:"performance",name:"性能检验"},
|
||||||
|
],
|
||||||
|
tags_:{
|
||||||
|
"purin":"入厂检验",
|
||||||
|
"first":"首件检验",
|
||||||
|
"prod":"成品检验",
|
||||||
|
"process":"过程检验",
|
||||||
|
"performance":"性能检验"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
//添加检验表
|
||||||
|
tableAdd(){
|
||||||
|
this.limitedVisible = true;
|
||||||
|
this.type = "add";
|
||||||
|
this.form.id="";
|
||||||
|
this.form.name="";
|
||||||
|
this.form.number="";
|
||||||
|
this.form.tags=[];
|
||||||
|
},
|
||||||
|
//编辑
|
||||||
|
tableEdit(row){
|
||||||
|
this.type='edit';
|
||||||
|
this.form.id=row.id;
|
||||||
|
this.form.name=row.name;
|
||||||
|
this.form.number=row.number;
|
||||||
|
this.form.tags=row.tags;
|
||||||
|
this.limitedVisible = true;
|
||||||
|
},
|
||||||
|
//查看
|
||||||
|
tableDetail(row) {
|
||||||
|
this.$TOOL.data.set('qctCurrent',row);
|
||||||
|
this.type = row.type;
|
||||||
|
this.qctId = row.id;
|
||||||
|
this.visibleDrawer = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.showDrawer.open();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//提交
|
||||||
|
submitHandle(){
|
||||||
|
let that = this;
|
||||||
|
that.$refs.form.validate( (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
that.isSaving = true;
|
||||||
|
if(that.type==='add'){
|
||||||
|
that.$API.qm.qct.create.req(that.form).then(res=>{
|
||||||
|
that.isSaving = false;
|
||||||
|
that.limitedVisible = false;
|
||||||
|
that.$refs.table.refresh();
|
||||||
|
}).catch(e=>{that.isSaving = false;})
|
||||||
|
}else{
|
||||||
|
that.$API.qm.qct.update.req(that.form.id,that.form).then(res=>{
|
||||||
|
that.isSaving = false;
|
||||||
|
that.limitedVisible = false;
|
||||||
|
that.$refs.table.refresh();
|
||||||
|
}).catch(e=>{that.isSaving = false;})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
//删除检验表
|
||||||
|
async tableDel(row){
|
||||||
|
var id = row.id;
|
||||||
|
var res = await this.$API.qm.qct.delete.req(id);
|
||||||
|
if(res.err_msg){
|
||||||
|
this.$message.error(res.err_msg)
|
||||||
|
}else{
|
||||||
|
this.$refs.table.refresh();
|
||||||
|
this.$message.success("删除成功")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//搜索
|
||||||
|
handleQuery(){
|
||||||
|
this.$refs.table.queryData(this.query)
|
||||||
|
},
|
||||||
|
dialogClose(){
|
||||||
|
this.isSaving = false;
|
||||||
|
this.limitedVisible = false;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.treeMain {width: 100%;height:280px;overflow: auto;border: 1px solid #dcdfe6;margin-bottom: 10px;}
|
||||||
|
</style>
|
|
@ -0,0 +1,352 @@
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
v-model="visible"
|
||||||
|
title="检测表详情"
|
||||||
|
:size="'90%'"
|
||||||
|
destroy-on-close
|
||||||
|
@closed="$emit('closed')"
|
||||||
|
>
|
||||||
|
<div style="padding: 8px">
|
||||||
|
<el-card style="width: 100%" header="基本信息" shadow="hover">
|
||||||
|
<el-descriptions>
|
||||||
|
<el-descriptions-item label="名称">{{qctItem.number}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="编号">{{qctItem.number}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="检测类型">
|
||||||
|
<span v-for="(item,index) in qctItem.tags" :key="item">
|
||||||
|
{{ tags_[item] }} <span v-if="index < qctItem.tags.length - 1">、</span>
|
||||||
|
</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<!-- <el-descriptions-item label="创建时间">{{qctItem.create_time}}</el-descriptions-item> -->
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
<div style="height: 8px"></div>
|
||||||
|
<div>
|
||||||
|
<!-- 检测物料qctmat -->
|
||||||
|
<el-card style="width: 100%" header="检测物料" shadow="hover">
|
||||||
|
<sc-form-table
|
||||||
|
hideDelete
|
||||||
|
hideIndex
|
||||||
|
v-model="qctmatlist"
|
||||||
|
:addTemplate="mataddTemplate"
|
||||||
|
placeholder="暂无数据"
|
||||||
|
>
|
||||||
|
<el-table-column prop="type" label="物料">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.material_name }}</span>
|
||||||
|
<xtSelect
|
||||||
|
v-else
|
||||||
|
:apiObj="apiObj"
|
||||||
|
v-model="scope.row.material"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="规格" prop="specification"></el-table-column>
|
||||||
|
</xtSelect>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="time" label="追溯层级">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ tracing_[scope.row.tracing] }}</span>
|
||||||
|
<el-select
|
||||||
|
v-else
|
||||||
|
v-model="scope.row.tracing"
|
||||||
|
filterable
|
||||||
|
placeholder="请选择追溯层级"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in tracingOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="open" label="操作" width="80" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.id"
|
||||||
|
text
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="formTableDel(scope.row.id,'mat')"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="formTableAdd(scope.row,'mat')"
|
||||||
|
>添加</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</sc-form-table>
|
||||||
|
</el-card>
|
||||||
|
<!-- 检测项qcttestitem -->
|
||||||
|
<el-card style="width: 100%" header="检测项" shadow="hover">
|
||||||
|
<sc-form-table
|
||||||
|
hideIndex
|
||||||
|
v-model="qcttestitemlist"
|
||||||
|
:addTemplate="defectaddTemplate"
|
||||||
|
placeholder="暂无数据"
|
||||||
|
>
|
||||||
|
<el-table-column prop="val" label="排序" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.sort }}</span>
|
||||||
|
<el-input v-else v-model="scope.row.sort" placeholder="排序"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="time" label="检测项">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{scope.row.testitem_name}}</span>
|
||||||
|
<xtSelect
|
||||||
|
v-else
|
||||||
|
:apiObj="apiObj2"
|
||||||
|
v-model="scope.row.testitem"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="描述" prop="description"></el-table-column>
|
||||||
|
</xtSelect>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="type" label="备注">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.note }}</span>
|
||||||
|
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="open" label="操作" width="80" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.id"
|
||||||
|
text
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="formTableDel(scope.row.id,'testitem')"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="formTableAdd(scope.row,'testitem')"
|
||||||
|
>添加</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</sc-form-table>
|
||||||
|
</el-card>
|
||||||
|
<!-- 检测缺陷项qctdefect -->
|
||||||
|
<el-card style="width: 100%" header="检测缺陷项" shadow="hover">
|
||||||
|
<sc-form-table
|
||||||
|
hideIndex
|
||||||
|
v-model="qctdefectlist"
|
||||||
|
:addTemplate="testitemaddTemplate"
|
||||||
|
placeholder="暂无数据"
|
||||||
|
>
|
||||||
|
<el-table-column prop="val" label="排序" width="80">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.sort }}</span>
|
||||||
|
<el-input v-else v-model="scope.row.sort" placeholder="排序"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="time" label="缺陷项">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{scope.row.defect_name}}</span>
|
||||||
|
<xtSelect
|
||||||
|
v-else
|
||||||
|
:apiObj="apiObj3"
|
||||||
|
v-model="scope.row.defect"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<el-table-column label="名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="分类" prop="cate"></el-table-column>
|
||||||
|
</xtSelect>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="val" label="判定表达式" min-width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.rule_expression }}</span>
|
||||||
|
<el-input v-else v-model="scope.row.rule_expression" placeholder="请输入判定表达式"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="type" label="备注">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.id">{{ scope.row.note }}</span>
|
||||||
|
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="open" label="操作" width="80" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.id"
|
||||||
|
text
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="formTableDel(scope.row.id,'defect')"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-else
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="formTableAdd(scope.row,'defect')"
|
||||||
|
>添加</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</sc-form-table>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "qctDetail",
|
||||||
|
props: {
|
||||||
|
qctId: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialog: {
|
||||||
|
check: false,
|
||||||
|
save: false,
|
||||||
|
},
|
||||||
|
apiObj:this.$API.mtm.material.list,
|
||||||
|
materials:[],
|
||||||
|
apiObj2:this.$API.qm.testitem.list,
|
||||||
|
testitemes:[],
|
||||||
|
apiObj3:this.$API.qm.defect.list,
|
||||||
|
defects:[],
|
||||||
|
apiObjMat: null,
|
||||||
|
apiObjDefect: null,
|
||||||
|
apiObjTestItem: null,
|
||||||
|
params: {},
|
||||||
|
qctItem: {},
|
||||||
|
qctmatlist:[], //物料
|
||||||
|
qctdefectlist:[],
|
||||||
|
qcttestitemlist:[],
|
||||||
|
visible: false,
|
||||||
|
tags_:{
|
||||||
|
"purin":"入厂检验",
|
||||||
|
"first":"首件检验",
|
||||||
|
"prod":"成品检验",
|
||||||
|
"process":"过程检验",
|
||||||
|
"performance":"性能检验"
|
||||||
|
},
|
||||||
|
tracing_:{
|
||||||
|
"test":"检测项",
|
||||||
|
"defect":"缺陷项",
|
||||||
|
},
|
||||||
|
tracingOptions:[
|
||||||
|
{value:'test',label:'检测项'},
|
||||||
|
{value:'defect',label:'缺陷项'},
|
||||||
|
],
|
||||||
|
mataddTemplate:{
|
||||||
|
tracing: "",
|
||||||
|
qct: this.qctId,
|
||||||
|
material: "",
|
||||||
|
},
|
||||||
|
defectaddTemplate:{
|
||||||
|
qct: this.qctId,
|
||||||
|
defect: "",
|
||||||
|
note:'',
|
||||||
|
sort:'',
|
||||||
|
rule_expression:'',
|
||||||
|
},
|
||||||
|
testitemaddTemplate:{
|
||||||
|
qct: this.qctId,
|
||||||
|
note:'',
|
||||||
|
sort:'',
|
||||||
|
testitem:'',
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.apiObjMat = this.$API.inm.mioitem.list;
|
||||||
|
this.apiObjDefect = this.$API.inm.mioitem.list;
|
||||||
|
this.apiObjTestItem = this.$API.inm.mioitem.list;
|
||||||
|
this.qctItem =this.$TOOL.data.get("qctCurrent");
|
||||||
|
this.getLists();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
getLists(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.qm.qctmat.list.req({qct:that.qctItem.id,page:0}).then(res=>{
|
||||||
|
that.qctmatlist = res;
|
||||||
|
});
|
||||||
|
that.$API.qm.qctdefect.list.req({qct:that.qctItem.id,page:0}).then(res=>{
|
||||||
|
that.qctdefectlist = res;
|
||||||
|
});
|
||||||
|
that.$API.qm.qcttestitem.list.req({qct:that.qctItem.id,page:0}).then(res=>{
|
||||||
|
that.qcttestitemlist = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//添加
|
||||||
|
formTableAdd(row,type) {
|
||||||
|
let that = this,api = '';
|
||||||
|
if(type=='defect'){
|
||||||
|
api = that.$API.qm.qctdefect.create;
|
||||||
|
}else if(type=='mat'){
|
||||||
|
api = that.$API.qm.qctmat.create;
|
||||||
|
}else if(type=='testitem'){
|
||||||
|
api = that.$API.qm.qcttestitem.create;
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
api.req(row).then((res) => {
|
||||||
|
that.$message.success("添加成功");
|
||||||
|
that.getLists();
|
||||||
|
return res;
|
||||||
|
}).catch((err) => {
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//删除
|
||||||
|
formTableDel(id,type) {
|
||||||
|
let that = this,api = '';
|
||||||
|
if(type=='defect'){
|
||||||
|
api = that.$API.qm.qctdefect.delete;
|
||||||
|
}else if(type=='mat'){
|
||||||
|
api = that.$API.qm.qctmat.delete;
|
||||||
|
}else if(type=='testitem'){
|
||||||
|
api = that.$API.qm.qcttestitem.delete;
|
||||||
|
}
|
||||||
|
that.$confirm(`确定删除吗?`, "提示", {
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
api.req(id).then((res) => {
|
||||||
|
that.$message.success("删除成功");
|
||||||
|
that.getLists();
|
||||||
|
return res;
|
||||||
|
}).catch((err) => {
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
|
||||||
|
//编辑
|
||||||
|
check_edit(row) {
|
||||||
|
this.mioitemId = row.id;
|
||||||
|
this.objitem = row;
|
||||||
|
this.dialog.check = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.checkDialog.open("edit").setData(row);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -83,8 +83,10 @@
|
||||||
"selects-text":"多选",
|
"selects-text":"多选",
|
||||||
},
|
},
|
||||||
tags_:{
|
tags_:{
|
||||||
|
"purin":"入厂检验",
|
||||||
"first":"首件检验",
|
"first":"首件检验",
|
||||||
"prod":"成品检验",
|
"prod":"成品检验",
|
||||||
|
"process":"过程检验",
|
||||||
"performance":"性能检验"
|
"performance":"性能检验"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ export default {
|
||||||
show: "查看",
|
show: "查看",
|
||||||
},
|
},
|
||||||
//表单数据
|
//表单数据
|
||||||
form: defaultForm,
|
form: {},
|
||||||
//验证规则
|
//验证规则
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
|
@ -169,6 +169,8 @@ export default {
|
||||||
{value:"selects-text",name:"多选"},
|
{value:"selects-text",name:"多选"},
|
||||||
],
|
],
|
||||||
tagsOptions: [
|
tagsOptions: [
|
||||||
|
{value:"purin",name:"入厂检验"},
|
||||||
|
{value:"process",name:"过程检验"},
|
||||||
{value:"first",name:"首件检验"},
|
{value:"first",name:"首件检验"},
|
||||||
{value:"prod",name:"成品检验"},
|
{value:"prod",name:"成品检验"},
|
||||||
{value:"performance",name:"性能检验"},
|
{value:"performance",name:"性能检验"},
|
||||||
|
@ -214,8 +216,8 @@ export default {
|
||||||
.req(that.form)
|
.req(that.form)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
that.isSaveing = false;
|
that.isSaveing = false;
|
||||||
that.$emit("success");
|
|
||||||
that.visible = false;
|
that.visible = false;
|
||||||
|
that.$emit("success");
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
that.isSaveing = false;
|
that.isSaveing = false;
|
||||||
|
@ -225,8 +227,8 @@ export default {
|
||||||
.req(that.form.id, that.form)
|
.req(that.form.id, that.form)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
that.isSaveing = false;
|
that.isSaveing = false;
|
||||||
that.$emit("success");
|
|
||||||
that.visible = false;
|
that.visible = false;
|
||||||
|
that.$emit("success");
|
||||||
})
|
})
|
||||||
.catch((res) => {
|
.catch((res) => {
|
||||||
that.isSaveing = false;
|
that.isSaveing = false;
|
||||||
|
|
Loading…
Reference in New Issue