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,
isSaveing: false,
cateOptions:[],
// cateOptions: [
// { id: "bang", name: "" },
// { id: "guan", name: "" },

View File

@ -31,14 +31,13 @@
:params="query"
>
<el-table-column type="index" width="50" />
<el-table-column
label="日期"
prop="test_date"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="日期" prop="test_date"></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_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">
<template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)"
@ -66,7 +65,7 @@
<check-dialog
ref="checkDialogs"
v-if="dialog.check"
:type="product_type"
:materialCate="materialCate"
:ftestWork="ftestWork"
@closed="dialog.check = false"
>
@ -94,6 +93,8 @@ export default {
page_size: 20,
type: 10,
},
ftestWork:'',
materialCate:'',
selection: [],
};
},
@ -136,16 +137,8 @@ export default {
});
},
table_check(row) {
debugger;
console.log(row);
let that = this;
let type = "";
if (row.material_name.indexOf("棒") > -1) {
type = "bang";
} else {
type = "guan";
}
that.product_type = type;
that.materialCate = row.material_cate;
that.ftestWork = row.id;
that.dialog.check = true;
this.$nextTick(() => {

View File

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

View File

@ -52,6 +52,36 @@
/>
</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_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-form>
</el-main>
@ -104,6 +134,13 @@ export default {
this.visible = true;
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() {
let that = this;