fix:成品检验变更(ps:需要改动的地方:物料的物料系列,检测项目testitem的字段类型,检验类型,物料系列标签)

This commit is contained in:
shijing 2024-08-07 17:51:05 +08:00
parent 34838c76b3
commit e68b15b12b
4 changed files with 162 additions and 179 deletions

View File

@ -248,6 +248,7 @@ export default {
}, },
visible: false, visible: false,
isSaveing: false, isSaveing: false,
cateOptions:[],
// cateOptions: [ // cateOptions: [
// { id: "bang", name: "" }, // { id: "bang", name: "" },
// { id: "guan", name: "" }, // { id: "guan", name: "" },

View File

@ -31,14 +31,13 @@
:params="query" :params="query"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column <el-table-column label="日期" prop="test_date"></el-table-column>
label="日期"
prop="test_date"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="批次号" prop="batch"> </el-table-column> <el-table-column label="批次号" prop="batch"> </el-table-column>
<el-table-column label="物料名" prop="material_name" show-overflow-tooltip> </el-table-column>
<el-table-column label="总数" prop="count"> </el-table-column> <el-table-column label="总数" prop="count"> </el-table-column>
<el-table-column label="抽检数" prop="count_sampling"> </el-table-column>
<el-table-column label="合格数" prop="count_ok"> </el-table-column>
<el-table-column label="不合格数" prop="count_notok"> </el-table-column>
<el-table-column label="操作" fixed="right" width="150"> <el-table-column label="操作" fixed="right" width="150">
<template #default="scope"> <template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)" <el-link type="primary" @click="table_edit(scope.row)"
@ -66,7 +65,7 @@
<check-dialog <check-dialog
ref="checkDialogs" ref="checkDialogs"
v-if="dialog.check" v-if="dialog.check"
:type="product_type" :materialCate="materialCate"
:ftestWork="ftestWork" :ftestWork="ftestWork"
@closed="dialog.check = false" @closed="dialog.check = false"
> >
@ -94,6 +93,8 @@ export default {
page_size: 20, page_size: 20,
type: 10, type: 10,
}, },
ftestWork:'',
materialCate:'',
selection: [], selection: [],
}; };
}, },
@ -136,16 +137,8 @@ export default {
}); });
}, },
table_check(row) { table_check(row) {
debugger;
console.log(row);
let that = this; let that = this;
let type = ""; that.materialCate = row.material_cate;
if (row.material_name.indexOf("棒") > -1) {
type = "bang";
} else {
type = "guan";
}
that.product_type = type;
that.ftestWork = row.id; that.ftestWork = row.id;
that.dialog.check = true; that.dialog.check = true;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -10,28 +10,37 @@
<div> <div>
<el-card style="width: 100%" header="基本信息" shadow="hover"> <el-card style="width: 100%" header="基本信息" shadow="hover">
<el-descriptions> <el-descriptions>
<el-descriptions-item label="日期">{{ <el-descriptions-item label="物料">{{
workObj.test_date workObj.material_name
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="批次号">{{ <el-descriptions-item label="批次号">{{
workObj.batch workObj.batch
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="物料">{{ <el-descriptions-item label="日期">{{
workObj.material_name workObj.test_date
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="总数">{{ <el-descriptions-item label="总数">{{
workObj.count workObj.count
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="合格数">{{
workObj.count_ok
}}</el-descriptions-item>
<el-descriptions-item label="不合格数">{{
workObj.count_notok
}}</el-descriptions-item>
<el-descriptions-item label="抽检数">{{
workObj.count_sampling
}}</el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-button
type="primary" @click="table_edit(workObj)">编辑</el-button>
</el-card> </el-card>
</div> </div>
<div style="height: 8px"></div> <div style="height: 8px"></div>
<div> <div>
<el-card style="width: 100%" header="检验记录" shadow="hover"> <el-card style="width: 100%" header="检验记录" shadow="hover">
<!-- 预制棒 -->
<sc-form-table <sc-form-table
ref="formTable" ref="formTable"
v-if="type == 'bang'"
v-model="formTableData" v-model="formTableData"
:addTemplate="addTemplate" :addTemplate="addTemplate"
placeholder="暂无数据" placeholder="暂无数据"
@ -56,16 +65,29 @@
:key="item0.id" :key="item0.id"
> >
<el-table-column <el-table-column
prop="test_val" prop="test_val_json"
:label="item0.name" :label="item0.name"
min-width="130" min-width="130"
> >
<template #default="scope"> {{ftestitems[$index].field_type}}
<!-- 小数 -->
<template v-if="ftestitems[$index].field_type == 'input-number'" #default="scope">
<el-input-number <el-input-number
v-model=" v-model="scope.row.ftestitems[$index].test_val_json"
scope.row.ftestitems[$index] :disabled="!scope.row.isEdit"
.test_val :min="0"
" :precision="2"
style="width: 100%"
controls-position="right"
>
</el-input-number>
</template>
<!-- 整数 -->
<template v-else-if="ftestitems[$index].field_type == 'input_int'" #default="scope">
<el-input-number
v-model="scope.row.ftestitems[$index].test_val_json"
:precision="0"
:disabled="!scope.row.isEdit" :disabled="!scope.row.isEdit"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
@ -73,11 +95,53 @@
> >
</el-input-number> </el-input-number>
</template> </template>
<!-- 文本 -->
<template v-else-if="ftestitems[$index].field_type == 'input_text'" #default="scope">
<el-input
v-model="scope.row.ftestitems[$index].test_val_json"
:disabled="!scope.row.isEdit"
>
</el-input>
</template>
<!-- 单选 -->
<template v-else-if="ftestitems[$index].field_type == 'select'" #default="scope">
<el-select
v-model="scope.row.ftestitems[$index].test_val_json"
clearable
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option
v-for="item in ftestitems[$index].choices"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</template>
<!-- 多选 -->
<template v-else-if="ftestitems[$index].field_type == 'selects'" #default="scope">
<el-select
v-model="scope.row.ftestitems[$index].test_val_json"
clearable
multiple
:disabled="!scope.row.isEdit"
style="width: 100%"
>
<el-option
v-for="item in ftestitems[$index].choices"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</template>
</el-table-column> </el-table-column>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="test_val"
label="合格判定" label="合格判定"
min-width="90" min-width="90"
> >
@ -155,136 +219,6 @@
</template> </template>
</el-table-column> </el-table-column>
</sc-form-table> </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> </el-card>
</div> </div>
</div> </div>
@ -301,9 +235,16 @@
@closed="dialog.save = false" @closed="dialog.save = false"
> >
</save-dialog> </save-dialog>
<save-work-dialog
v-if="dialog.worksave"
ref="saveWorkDialog"
@success="handleWorkSaveSuccess"
@closed="dialog.worksave = false"
></save-work-dialog>
</template> </template>
<script> <script>
import saveDialog from "./product_check.vue"; import saveDialog from "./product_check.vue";
import saveWorkDialog from "./product_form.vue";
export default { export default {
name: "mioitem", name: "mioitem",
emits: ["success", "closed"], emits: ["success", "closed"],
@ -312,18 +253,18 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
type: { materialCate: {
type: String, type: String,
default: "", default: "",
}, },
}, },
components: { components: {
saveDialog, saveDialog,saveWorkDialog
}, },
data() { data() {
return { return {
addTemplate: { addTemplate: {
ftestitems: [{ test_val: "", check_val: "", testitem: "" }], ftestitems: [{ test_val_json: "", check_val: "", testitem: "" ,choices:[],field_type:'',name:''}],
test_date: "", //work test_date: "", //work
test_numer: "", test_numer: "",
is_ok: true, is_ok: true,
@ -334,14 +275,12 @@ export default {
}, },
ftestitems: [], ftestitems: [],
dialog: { dialog: {
check: false, worksave: false,
save: false, save: false,
}, },
apiObj: null, apiObj: null,
params: {}, params: {},
formTableData: [], formTableData: [],
// ftestWork: "",
// type: "",
userList: [], userList: [],
workObj: {}, workObj: {},
visible: false, visible: false,
@ -355,16 +294,15 @@ export default {
}, },
mounted() { mounted() {
let that = this; let that = this;
// that.type = that.$route.query.type;
// that.ftestWork = that.$route.query.ftestWork;
that.addTemplate.ftest_work = that.ftestWork; that.addTemplate.ftest_work = that.ftestWork;
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => { that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res; that.workObj = res;
that.addTemplate.test_date = res.test_date; that.addTemplate.test_date = res.test_date;
that.getCheckList(that.ftestWork); that.getCheckList(that.ftestWork);
}); });
let tag = that.type == "bang" ? "prod_bang" : "prod_guan";
that.getTestItem(tag, that.ftestWork); let tags = that.materialCate;
that.getTestItem(tags, that.ftestWork);
that.getUserList(that.ftestWork); that.getUserList(that.ftestWork);
}, },
methods: { methods: {
@ -372,32 +310,44 @@ export default {
this.visible = true; this.visible = true;
}, },
// //
getTestItem(tag, ftestWork) { getTestItem(tags, ftestWork) {
//tags__contains:// mcate_tags__contains:///
let that = this; let that = this;
that.$API.qm.getTestItem that.$API.qm.getTestItem
.get({ tag: tag, page: 0, ftest_work: ftestWork }) .get({ tags__contains: 'prod',mcate_tags__contains:tags, page: 0})
.then((res) => { .then((res) => {
let arr = res; let arr = res;
that.ftestitems = res; that.ftestitems = res;
console.log('res',res)
let ftestitems = []; let ftestitems = [];
arr.forEach((item) => { arr.forEach((item) => {
let obj = {}; let obj = {};
obj.test_val = 0; obj.test_val_json = null;
obj.testitem = item.id; obj.testitem = item.id;
obj.field_type = item.field_type;
ftestitems.push(obj); ftestitems.push(obj);
}); });
that.addTemplate.ftestitems = ftestitems; that.addTemplate.ftestitems = ftestitems;
console.log('addTemplate.ftestitems',that.addTemplate.ftestitems)
}); });
}, },
// //
getUserList() { getUserList() {
let that = this; let that = this;
this.$API.system.user.list this.$API.system.user.list
.req({ page: 0, posts__name: "检验" }) // .req({ page: 0, posts__name: "" })
.req({ page: 0 })
.then((res) => { .then((res) => {
that.userList = res; that.userList = res;
}); });
}, },
table_edit(row) {
this.dialog.worksave = true;
this.$nextTick(() => {
this.$refs.saveWorkDialog.open("edit").setData(row);
});
},
// //
getCheckList(ftestwork) { getCheckList(ftestwork) {
let that = this; let that = this;
@ -406,12 +356,7 @@ export default {
.req({ page: 0, type: "prod", ftest_work: ftestwork }) .req({ page: 0, type: "prod", ftest_work: ftestwork })
.then((res) => { .then((res) => {
if (res.length > 0) { if (res.length > 0) {
that.addTemplate.test_numer = that.addTemplate.test_numer = that.workObj.batch + "_" + (res.length + 1);
that.workObj.batch + "_" + (res.length + 1);
console.log(
"that.addTemplate.test_numer",
that.addTemplate.test_numer
);
res.forEach((item) => { res.forEach((item) => {
let obj = {}; let obj = {};
obj = item; obj = item;
@ -422,6 +367,7 @@ export default {
}); });
}, },
testNumberChange() { testNumberChange() {
console.log('this.formTableData',this.formTableData)
this.addTemplate.test_numer = this.addTemplate.test_numer =
this.workObj.batch + "_" + (this.formTableData.length + 1); this.workObj.batch + "_" + (this.formTableData.length + 1);
}, },
@ -486,6 +432,12 @@ export default {
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },
handleWorkSaveSuccess(){
let that = this;
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res;
});
},
handleCheckSuccess() { handleCheckSuccess() {
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },

View File

@ -52,6 +52,36 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24">
<el-form-item label="抽检数量">
<el-input-number
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input-number
controls-position="right"
v-model="form.count_ok"
style="width: 100%"
@change="handleCountChange('ok')"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
controls-position="right"
v-model="form.count_notok"
style="width: 100%"
@change="handleCountChange('notok')"
></el-input-number>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-main> </el-main>
@ -104,6 +134,13 @@ export default {
this.visible = true; this.visible = true;
return this; return this;
}, },
handleCountChange(type){
if(type == 'ok'){
this.form.count_notok = this.form.count - this.form.count_ok
}else if(type == 'notok'){
this.form.count_ok = this.form.count - this.form.count_notok
}
},
// //
getMaterialBatch() { getMaterialBatch() {
let that = this; let that = this;