fix:检验加备注

This commit is contained in:
shijing 2024-04-01 15:45:17 +08:00
parent 142233e6c0
commit 8ae196b9e3
5 changed files with 1603 additions and 1185 deletions

View File

@ -719,6 +719,11 @@
</el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input v-model="form.note"> </el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="称重记录/Kg">
<el-button
@ -728,7 +733,6 @@
></el-button>
</el-form-item>
</el-col>
<el-col
:md="12"
:sm="24"

View File

@ -1,217 +1,349 @@
<template>
<el-dialog title="首件检验" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="检验日期" prop="test_date">
<el-date-picker v-model="form.test_date" type="date" value-format="YYYY-MM-DD" style="width:100%" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检编号">
<el-input v-model="form.test_numer"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-table :data="form.ftestitems" border placeholder="暂无数据">
<el-table-column prop="testitem" label="检测项" min-width="100" align="center">
<template #default="scope">
<span>{{ scope.row.testitem_name }}</span>
</template>
</el-table-column>
<el-table-column prop="test_val" label="操作人检测值" min-width="120" align="center">
<template #default="scope">
<el-input-number v-model="scope.row.test_val" :min="0" style="width:100%" controls-position="right">
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="check_val" label="专检人测量值" min-width="120" align="center">
<template #default="scope">
<el-input-number v-model="scope.row.check_val" :min="0" style="width:100%" controls-position="right">
</el-input-number>
</template>
</el-table-column>
</el-table>
<el-row style="margin-top:14px">
<el-col :md="12" :sm="24">
<el-form-item label="检验工序集" prop="test_group">
<el-select v-model="form.test_group" placeholder="检验工序集" clearable style="width:100%">
<el-option v-for="item in processOptions" :key="item" :label="item" :value="item">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" prop="is_ok">
<el-form-item label="合格判定" prop="is_ok">
<el-select v-model="form.is_ok" placeholder="合格判定" clearable style="width:100%">
<el-option label="合格" :value="true" />
<el-option label="不合格" :value="false" />
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="操作人" prop="test_user">
<el-select v-model="form.test_user" placeholder="操作人" clearable filterable style="width:100%">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="专检人" prop="check_user">
<el-select v-model="form.check_user" placeholder="专检人" clearable filterable style="width:100%">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input v-model="form.note" placeholder="备注"/>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
<el-dialog
title="首件检验"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="100px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="检验日期" prop="test_date">
<el-date-picker
v-model="form.test_date"
type="date"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检编号">
<el-input v-model="form.test_numer"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-table
:data="form.ftestitems"
border
placeholder="暂无数据"
>
<el-table-column
prop="testitem"
label="检测项"
min-width="100"
align="center"
>
<template #default="scope">
<span>{{ scope.row.testitem_name }}</span>
</template>
</el-table-column>
<el-table-column
prop="test_val"
label="操作人检测值"
min-width="120"
align="center"
>
<template #default="scope">
<el-input-number
v-model="scope.row.test_val"
:min="0"
style="width: 100%"
controls-position="right"
>
</el-input-number>
</template>
</el-table-column>
<el-table-column
prop="check_val"
label="专检人测量值"
min-width="120"
align="center"
>
<template #default="scope">
<el-input-number
v-model="scope.row.check_val"
:min="0"
style="width: 100%"
controls-position="right"
>
</el-input-number>
</template>
</el-table-column>
</el-table>
<el-row style="margin-top: 14px">
<el-col :md="12" :sm="24">
<el-form-item label="检验工序集" prop="test_group">
<el-select
v-model="form.test_group"
placeholder="检验工序集"
clearable
style="width: 100%"
>
<el-option
v-for="item in processOptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" prop="is_ok">
<el-form-item label="合格判定" prop="is_ok">
<el-select
v-model="form.is_ok"
placeholder="合格判定"
clearable
style="width: 100%"
>
<el-option label="合格" :value="true" />
<el-option label="不合格" :value="false" />
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="操作人" prop="test_user">
<el-select
v-model="form.test_user"
placeholder="操作人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="专检人" prop="check_user">
<el-select
v-model="form.check_user"
placeholder="专检人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input
v-model="form.note"
placeholder="备注"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
form: {
type: 'first',
ftestitems: [],
},
rules: {
belong_dept: [{ required: true, message: "请选择所属部门", trigger: "blur" }],
test_date: [{ required: true, message: "请选择检验日期", trigger: "blur" }],
test_user: [{ required: true, message: "请选择操作人", trigger: "blur" }],
check_user: [{ required: true, message: "请选择专检人", trigger: "blur" }],
test_group: [{ required: true, message: "请选择检测工序集", trigger: "blur" }],
is_ok: [{ required: true, message: "请选择是否合格", trigger: "blur" }],
},
visible: false,
isSaveing: false,
userList: [],
options: [],
processOptions: ['粗中细磨', '抛光', '半抛光'],
deptOptions: [],
selectionFilters: [],
setFiltersVisible: false,
belong_dept_options: [],
group: [],
};
},
mounted() {
// this.getProcess();
this.getUserList();
this.getDeptOptions();
},
methods: {
//
open(mode = "add") {
this.mode = mode;
if (mode == "add") {
this.getTextItem();
}
this.visible = true;
return this;
},
//
getTextItem() {
let that = this;
that.$API.qm.getTestItem.get({ tag: 'first', page: 0 }).then(res => {
console.log(res)
let ftestitems = [];
res.forEach(item => {
let obj = {};
obj.testitem = item.id;
obj.testitem_name = item.name;
obj.test_val = 0;
obj.check_val = 0;
ftestitems.push(obj)
})
console.log(ftestitems)
that.form.ftestitems = ftestitems;
})
},
//
getDeptOptions() {
this.$API.system.dept.list.req({ page: 0, type__in: 'dept' }).then((res) => {
this.deptOptions = res;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list.req({ page: 0, depts__name: '检验管理部' }).then(res => {
that.userList = res.results;
});
},
// getProcess(){
// let that = this;
// this.$API.mtm.process.list.req({page:0}).then(res=>{
// let arr = [];
// res.forEach(item => {
// if(item.name==''){
// arr.push(item);
// }
// })
// that.processOptions = arr;
// })
// },
//
submit() {
console.log('111111')
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
try {
if (that.mode == "add") {
that.$API.qm.ftest.create.req(that.form).then(res => {
that.$emit("success");
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
})
} else if (that.mode == "edit") {
that.$API.qm.ftest.update.req(that.form.id, that.form).then(res => {
that.$emit("success");
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
})
}
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
console.log('this.form', this.form)
// this.form.test_group = this.form.split(',')
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
form: {
type: "first",
ftestitems: [],
},
rules: {
belong_dept: [
{
required: true,
message: "请选择所属部门",
trigger: "blur",
},
],
test_date: [
{
required: true,
message: "请选择检验日期",
trigger: "blur",
},
],
test_user: [
{
required: true,
message: "请选择操作人",
trigger: "blur",
},
],
check_user: [
{
required: true,
message: "请选择专检人",
trigger: "blur",
},
],
test_group: [
{
required: true,
message: "请选择检测工序集",
trigger: "blur",
},
],
is_ok: [
{
required: true,
message: "请选择是否合格",
trigger: "blur",
},
],
},
visible: false,
isSaveing: false,
userList: [],
options: [],
processOptions: ["粗中细磨", "抛光", "半抛光"],
deptOptions: [],
selectionFilters: [],
setFiltersVisible: false,
belong_dept_options: [],
group: [],
};
},
mounted() {
// this.getProcess();
this.getUserList();
this.getDeptOptions();
},
methods: {
//
open(mode = "add") {
this.mode = mode;
if (mode == "add") {
this.getTextItem();
}
this.visible = true;
return this;
},
//
getTextItem() {
let that = this;
that.$API.qm.getTestItem
.get({ tag: "first", page: 0 })
.then((res) => {
console.log(res);
let ftestitems = [];
res.forEach((item) => {
let obj = {};
obj.testitem = item.id;
obj.testitem_name = item.name;
obj.test_val = 0;
obj.check_val = 0;
ftestitems.push(obj);
});
console.log(ftestitems);
that.form.ftestitems = ftestitems;
});
},
//
getDeptOptions() {
this.$API.system.dept.list
.req({ page: 0, type__in: "dept" })
.then((res) => {
this.deptOptions = res;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list
.req({ page: 0, depts__name: "检验管理部" })
.then((res) => {
that.userList = res.results;
});
},
// getProcess(){
// let that = this;
// this.$API.mtm.process.list.req({page:0}).then(res=>{
// let arr = [];
// res.forEach(item => {
// if(item.name==''){
// arr.push(item);
// }
// })
// that.processOptions = arr;
// })
// },
//
submit() {
console.log("111111");
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
try {
if (that.mode == "add") {
that.$API.qm.ftest.create
.req(that.form)
.then((res) => {
that.$emit("success");
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
});
} else if (that.mode == "edit") {
that.$API.qm.ftest.update
.req(that.form.id, that.form)
.then((res) => {
that.$emit("success");
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
});
}
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
console.log("this.form", this.form);
// this.form.test_group = this.form.split(',')
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>

View File

@ -1,278 +1,478 @@
<template>
<div style="padding: 8px">
<div>
<el-card style="width: 100%" header="基本信息" shadow="hover">
<el-descriptions>
<el-descriptions-item label="日期">{{ workObj.test_date }}</el-descriptions-item>
<el-descriptions-item label="批次号">{{ workObj.batch }}</el-descriptions-item>
<el-descriptions-item label="总数">{{ workObj.count }}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
<div style="height:8px"></div>
<div>
<el-card style="width: 100%" header="检验记录" shadow="hover">
<!-- 预制棒 -->
<sc-form-table ref="formTable" v-if="type == 'bang'" v-model="formTableData" :addTemplate="addTemplate"
placeholder="暂无数据">
<el-table-column prop="val" label="抽检编号" min-width="180">
<template #default="scope">
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input :disabled="!scope.row.isEdit" v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
<template v-for="(item0, $index) in ftestitems" :key="item0.id">
<el-table-column prop="test_val" :label="item0.name" min-width="130">
<template #default="scope">
<el-input-number v-model="scope.row.ftestitems[$index].test_val"
:disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right">
</el-input-number>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column prop="test_val" label="合格判定" min-width="90">
<template #default="scope">
<el-select v-model="scope.row.is_ok" placeholder="是否合格" clearable :disabled="!scope.row.isEdit"
style="width:100%">
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="test_user" label="检验人" width="120">
<template #default="scope">
<el-select v-model="scope.row.test_user" placeholder="检验人" clearable filterable
:disabled="!scope.row.isEdit" style="width:100%">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" fixed="right" width="90" align="center">
<template #default="scope">
<el-link type="primary" v-if="scope.row.isEdit" @click="saveCheck(scope.row)">保存</el-link>
<el-link type="primary" v-else @click="editCheck(scope.row)">编辑</el-link>
<el-link type="danger" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
</template>
</el-table-column>
</sc-form-table>
<!-- 预制管 -->
<sc-form-table ref="formTable" v-else-if="type == 'guan'" v-model="formTableData" :addTemplate="addTemplate"
placeholder="暂无数据">
<el-table-column prop="val" label="抽检编号" min-width="180">
<template #default="scope">
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input :disabled="!scope.row.isEdit" v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
<template v-for="(item, $index) in ftestitems" :key="item.id">
<el-table-column prop="test_val" :label="item.name" min-width="130">
<template #default="scope">
<el-input-number v-model="scope.row.ftestitems[$index].test_val"
:disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right">
</el-input-number>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column prop="test_val" label="合格判定" min-width="90" align="center">
<template #default="scope">
<el-select v-model="scope.row.is_ok" placeholder="是否合格" clearable :disabled="!scope.row.isEdit"
style="width:100%">
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="test_user" label="检验人" min-width="120" align="center">
<template #default="scope">
<el-select v-model="scope.row.test_user" placeholder="检验人" clearable filterable
:disabled="!scope.row.isEdit" style="width:100%">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" fixed="right" width="90" align="center">
<template #default="scope">
<el-link type="primary" v-if="scope.row.isEdit" @click="saveCheck(scope.row)">保存</el-link>
<el-link type="primary" v-else @click="editCheck(scope.row)">编辑</el-link>
<el-link type="danger" v-if="scope.row.id" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
</template>
</el-table-column>
</sc-form-table>
</el-card>
</div>
</div>
<save-dialog v-if="dialog.save" ref="saveDialog" :mioId="mioId" :belongDeptId="belongDeptId"
:belongDeptName="mioObj.belong_dept_name" :mioObj="mioObj" :cate="cate" @success="handleSaveSuccess"
@closed="dialog.save = false">
</save-dialog>
<div style="padding: 8px">
<div>
<el-card style="width: 100%" header="基本信息" shadow="hover">
<el-descriptions>
<el-descriptions-item label="日期">{{
workObj.test_date
}}</el-descriptions-item>
<el-descriptions-item label="批次号">{{
workObj.batch
}}</el-descriptions-item>
<el-descriptions-item label="总数">{{
workObj.count
}}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
<div style="height: 8px"></div>
<div>
<el-card style="width: 100%" header="检验记录" shadow="hover">
<!-- 预制棒 -->
<sc-form-table
ref="formTable"
v-if="type == 'bang'"
v-model="formTableData"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column
prop="val"
label="抽检编号"
min-width="180"
>
<template #default="scope">
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input
:disabled="!scope.row.isEdit"
v-model="scope.row.test_numer"
placeholder="抽检编号"
></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
<template
v-for="(item0, $index) in ftestitems"
:key="item0.id"
>
<el-table-column
prop="test_val"
:label="item0.name"
min-width="130"
>
<template #default="scope">
<el-input-number
v-model="
scope.row.ftestitems[$index]
.test_val
"
:disabled="!scope.row.isEdit"
:min="0"
style="width: 100%"
controls-position="right"
>
</el-input-number>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
prop="test_val"
label="合格判定"
min-width="90"
>
<template #default="scope">
<el-select
v-model="scope.row.is_ok"
placeholder="是否合格"
clearable
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</template>
</el-table-column>
<el-table-column
prop="test_user"
label="检验人"
width="120"
>
<template #default="scope">
<el-select
v-model="scope.row.test_user"
placeholder="检验人"
clearable
filterable
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="val" label="备注">
<template #default="scope">
<el-input
:disabled="!scope.row.isEdit"
v-model="scope.row.note"
placeholder="备注"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="open"
label="操作"
fixed="right"
width="90"
align="center"
>
<template #default="scope">
<el-link
type="primary"
v-if="scope.row.isEdit"
@click="saveCheck(scope.row)"
>保存</el-link
>
<el-link
type="primary"
v-else
@click="editCheck(scope.row)"
>编辑</el-link
>
<el-link
type="danger"
@click="delCheck(scope.row.id)"
style="margin-left: 2px"
>删除</el-link
>
</template>
</el-table-column>
</sc-form-table>
<!-- 预制管 -->
<sc-form-table
ref="formTable"
v-else-if="type == 'guan'"
v-model="formTableData"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column
prop="val"
label="抽检编号"
min-width="180"
>
<template #default="scope">
<!-- <span v-if="scope.row.id">{{ scope.row.test_numer }}</span> -->
<el-input
:disabled="!scope.row.isEdit"
v-model="scope.row.test_numer"
placeholder="抽检编号"
></el-input>
</template>
</el-table-column>
<el-table-column label="检验记录" align="center">
<template
v-for="(item, $index) in ftestitems"
:key="item.id"
>
<el-table-column
prop="test_val"
:label="item.name"
min-width="130"
>
<template #default="scope">
<el-input-number
v-model="
scope.row.ftestitems[$index]
.test_val
"
:disabled="!scope.row.isEdit"
:min="0"
style="width: 100%"
controls-position="right"
>
</el-input-number>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column
prop="test_val"
label="合格判定"
min-width="90"
align="center"
>
<template #default="scope">
<el-select
v-model="scope.row.is_ok"
placeholder="是否合格"
clearable
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</template>
</el-table-column>
<el-table-column
prop="test_user"
label="检验人"
min-width="120"
align="center"
>
<template #default="scope">
<el-select
v-model="scope.row.test_user"
placeholder="检验人"
clearable
filterable
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="val" label="备注">
<template #default="scope">
<el-input
:disabled="!scope.row.isEdit"
v-model="scope.row.note"
placeholder="备注"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="open"
label="操作"
fixed="right"
width="90"
align="center"
>
<template #default="scope">
<el-link
type="primary"
v-if="scope.row.isEdit"
@click="saveCheck(scope.row)"
>保存</el-link
>
<el-link
type="primary"
v-else
@click="editCheck(scope.row)"
>编辑</el-link
>
<el-link
type="danger"
v-if="scope.row.id"
@click="delCheck(scope.row.id)"
style="margin-left: 2px"
>删除</el-link
>
</template>
</el-table-column>
</sc-form-table>
</el-card>
</div>
</div>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:mioId="mioId"
:belongDeptId="belongDeptId"
:belongDeptName="mioObj.belong_dept_name"
:mioObj="mioObj"
:cate="cate"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
</template>
<script>
import saveDialog from "./product_check.vue";
export default {
name: "mioitem",
components: {
saveDialog
},
data() {
return {
addTemplate: {
ftestitems: [
{ test_val: '', check_val: '', testitem: '' },
],
test_date: '',//work
test_numer: '',
is_ok: true,
test_user: '',
ftest_work: '',//work
isEdit: true,
type: 'prod'
},
ftestitems: [],
dialog: {
check: false,
save: false,
},
apiObj: null,
params: {},
formTableData: null,
ftestWork: '',
type: '',
userList: [],
workObj: {},
};
},
watch: {
formTableData(newValue, oldValue) {
console.log('值发生了变化:', newValue);
this.testNumberChange();
}
},
mounted() {
let that = this;
that.type = that.$route.query.type;
that.ftestWork = that.$route.query.ftestWork;
that.addTemplate.ftest_work = that.ftestWork;
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res;
that.addTemplate.test_date = res.test_date;
that.addTemplate.test_numer = res.batch + '_1';
that.getCheckList();
})
let tag = that.type == 'bang' ? 'prod_bang' : 'prod_guan';
that.getTestItem(tag, that.ftestWork);
that.getUserList(that.ftestWork);
},
methods: {
//
getTestItem(tag, ftestWork) {
let that = this;
that.$API.qm.getTestItem.get({ tag: tag, page: 0, ftest_work: ftestWork }).then(res => {
let arr = res;
that.ftestitems = res;
let ftestitems = [];
arr.forEach(item => {
let obj = {};
obj.test_val = 0;
obj.testitem = item.id;
ftestitems.push(obj);
});
that.addTemplate.ftestitems = ftestitems;
})
},
//
getUserList() {
let that = this;
this.$API.system.user.list.req({ page: 0 }).then(res => {
that.userList = res;
});
},
//
getCheckList(ftestwork) {
let that = this;
that.formTableData = [];
this.$API.qm.ftest.list.req({ page: 0, type: 'prod', ftest_work: ftestwork }).then(res => {
if (res.length > 0) {
that.addTemplate.test_numer = that.workObj.batch + '_' + (res.length + 1);
console.log('that.addTemplate.test_numer', that.addTemplate.test_numer)
res.forEach(item => {
let obj = {};
obj = item;
obj.isEdit = false;
that.formTableData.push(obj);
})
}
})
},
testNumberChange() {
this.addTemplate.test_numer = this.workObj.batch + '_' + (this.formTableData.length + 1);
},
editCheck(row) {
this.formTableData.forEach((item, index) => {
if (item.id == row.id) {
this.formTableData[index].isEdit = true;
}
})
},
//
delCheck(id) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.qm.ftest.delete.req(id).then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
saveCheck(row) {
console.log(row);
let index = this.formTableData.findIndex(item => item.id == row.id);
if (row.id && row.id !== '') {
this.$API.qm.ftest.update.req(row.id, row).then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.formTable.refresh();
}).catch((err) => {
return err;
});
} else {
this.$API.qm.ftest.create.req(row).then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.formTable.refresh();
}).catch((err) => {
return err;
});
}
name: "mioitem",
components: {
saveDialog,
},
data() {
return {
addTemplate: {
ftestitems: [{ test_val: "", check_val: "", testitem: "" }],
test_date: "", //work
test_numer: "",
is_ok: true,
test_user: "",
ftest_work: "", //work
isEdit: true,
type: "prod",
},
ftestitems: [],
dialog: {
check: false,
save: false,
},
apiObj: null,
params: {},
formTableData: null,
ftestWork: "",
type: "",
userList: [],
workObj: {},
};
},
watch: {
formTableData(newValue, oldValue) {
console.log("值发生了变化:", newValue);
this.testNumberChange();
},
},
mounted() {
let that = this;
that.type = that.$route.query.type;
that.ftestWork = that.$route.query.ftestWork;
that.addTemplate.ftest_work = that.ftestWork;
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res;
that.addTemplate.test_date = res.test_date;
that.addTemplate.test_numer = res.batch + "_1";
that.getCheckList();
});
let tag = that.type == "bang" ? "prod_bang" : "prod_guan";
that.getTestItem(tag, that.ftestWork);
that.getUserList(that.ftestWork);
},
methods: {
//
getTestItem(tag, ftestWork) {
let that = this;
that.$API.qm.getTestItem
.get({ tag: tag, page: 0, ftest_work: ftestWork })
.then((res) => {
let arr = res;
that.ftestitems = res;
let ftestitems = [];
arr.forEach((item) => {
let obj = {};
obj.test_val = 0;
obj.testitem = item.id;
ftestitems.push(obj);
});
that.addTemplate.ftestitems = ftestitems;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list.req({ page: 0 }).then((res) => {
that.userList = res;
});
},
//
getCheckList(ftestwork) {
let that = this;
that.formTableData = [];
this.$API.qm.ftest.list
.req({ page: 0, type: "prod", ftest_work: ftestwork })
.then((res) => {
if (res.length > 0) {
that.addTemplate.test_numer =
that.workObj.batch + "_" + (res.length + 1);
console.log(
"that.addTemplate.test_numer",
that.addTemplate.test_numer
);
res.forEach((item) => {
let obj = {};
obj = item;
obj.isEdit = false;
that.formTableData.push(obj);
});
}
});
},
testNumberChange() {
this.addTemplate.test_numer =
this.workObj.batch + "_" + (this.formTableData.length + 1);
},
editCheck(row) {
this.formTableData.forEach((item, index) => {
if (item.id == row.id) {
this.formTableData[index].isEdit = true;
}
});
},
//
delCheck(id) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
})
.then(() => {
this.$API.qm.ftest.delete
.req(id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
})
.catch((err) => {
return err;
});
})
.catch(() => {});
},
saveCheck(row) {
console.log(row);
let index = this.formTableData.findIndex(
(item) => item.id == row.id
);
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh();
},
handleCheckSuccess() {
this.$refs.table.refresh();
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
mioSubmit() {
this.$API.inm.mio.submit.req(this.mioObj.id).then(res => {
this.$message.success("提交成功");
this.mioObj = res
})
}
},
if (row.id && row.id !== "") {
this.$API.qm.ftest.update
.req(row.id, row)
.then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.formTable.refresh();
})
.catch((err) => {
return err;
});
} else {
this.$API.qm.ftest.create
.req(row)
.then((res) => {
this.formTableData[index].isEdit = false;
this.$message.success("操作成功");
this.$refs.formTable.refresh();
})
.catch((err) => {
return err;
});
}
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh();
},
handleCheckSuccess() {
this.$refs.table.refresh();
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
mioSubmit() {
this.$API.inm.mio.submit.req(this.mioObj.id).then((res) => {
this.$message.success("提交成功");
this.mioObj = res;
});
},
},
};
</script>
</script>

View File

@ -249,6 +249,8 @@
</el-table-column>
<el-table-column label="气线" prop="气线">
</el-table-column>
<el-table-column label="相中破" prop="相中破">
</el-table-column>
<el-table-column label="合计" prop="不合格数">
</el-table-column>
</el-table-column>
@ -430,7 +432,7 @@ export default {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "8车间",
mgroup_name: "管料退火",
group_bys_material: "",
order_bys_material: "",
select_cols_material: "",

File diff suppressed because it is too large Load Diff