feat: 成品检验依据子项确定抽检数等

This commit is contained in:
caoqianming 2024-11-19 15:23:04 +08:00
parent 1849fe6eef
commit e94d3194ef
3 changed files with 48 additions and 55 deletions

View File

@ -38,6 +38,7 @@
<el-table-column label="物料名" prop="material_name" show-overflow-tooltip> </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_sampling"> </el-table-column>
<el-table-column label="抽检合格数" prop="count_sampling_ok"> </el-table-column>
<el-table-column label="合格数" prop="count_ok"> </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="不合格数" prop="count_notok"> </el-table-column>
<el-table-column label="操作" fixed="right" width="150"> <el-table-column label="操作" fixed="right" width="150">
@ -86,7 +87,7 @@
v-if="dialog.check" v-if="dialog.check"
:materialCate="materialCate" :materialCate="materialCate"
:ftestWork="ftestWork" :ftestWork="ftestWork"
@closed="dialog.check = false" @closed="handleCheckClose"
> >
</check-dialog> </check-dialog>
</el-container> </el-container>
@ -169,6 +170,10 @@ export default {
handleQuery() { handleQuery() {
this.$refs.table.queryData(this.query); this.$refs.table.queryData(this.query);
}, },
handleCheckClose() {
this.dialog.check = false;
this.$refs.table.refresh();
},
resetQuery() { resetQuery() {
this.query = {}; this.query = {};
}, },

View File

@ -32,7 +32,7 @@
workObj.count_sampling workObj.count_sampling
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="配棒管批次号" v-if=" workObj.mb_&&workObj.mb_.assemb"> <el-descriptions-item label="配棒管批次号" v-if=" workObj.mb_&&workObj.mb_.assemb">
<span v-for="item in workObj.mb_.assemb" :key="item.id">{{item.batch}}</span> <span v-for="item in workObj.mb_.assemb" :key="item.id">{{item.batch}}; </span>
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-button <el-button
@ -87,7 +87,7 @@
</el-input-number> </el-input-number>
</template> </template>
<!-- 整数 --> <!-- 整数 -->
<template v-else-if="ftestitems[$index].field_type == 'input_int'" #default="scope"> <template v-else-if="ftestitems[$index].field_type == 'input-int'" #default="scope">
<el-input-number <el-input-number
v-model="scope.row.ftestitems[$index].test_val_json" v-model="scope.row.ftestitems[$index].test_val_json"
:precision="0" :precision="0"
@ -99,7 +99,7 @@
</el-input-number> </el-input-number>
</template> </template>
<!-- 文本 --> <!-- 文本 -->
<template v-else-if="ftestitems[$index].field_type == 'input_text'" #default="scope"> <template v-else-if="ftestitems[$index].field_type == 'input-text'" #default="scope">
<el-input <el-input
v-model="scope.row.ftestitems[$index].test_val_json" v-model="scope.row.ftestitems[$index].test_val_json"
:disabled="!scope.row.isEdit" :disabled="!scope.row.isEdit"
@ -107,7 +107,7 @@
</el-input> </el-input>
</template> </template>
<!-- 单选 --> <!-- 单选 -->
<template v-else-if="ftestitems[$index].field_type == 'select'" #default="scope"> <template v-else-if="ftestitems[$index].field_type == 'select-text'" #default="scope">
<el-select <el-select
v-model="scope.row.ftestitems[$index].test_val_json" v-model="scope.row.ftestitems[$index].test_val_json"
clearable clearable
@ -124,7 +124,7 @@
</el-select> </el-select>
</template> </template>
<!-- 多选 --> <!-- 多选 -->
<template v-else-if="ftestitems[$index].field_type == 'selects'" #default="scope"> <template v-else-if="ftestitems[$index].field_type == 'selects-text'" #default="scope">
<el-select <el-select
v-model="scope.row.ftestitems[$index].test_val_json" v-model="scope.row.ftestitems[$index].test_val_json"
clearable clearable
@ -164,24 +164,20 @@
<el-table-column <el-table-column
prop="test_user" prop="test_user"
label="检验人" label="检验人"
width="120" width="160"
> >
<template #default="scope"> <template #default="scope">
<el-select <xtSelect
:apiObj="apiUserObj"
:params="apiUserParams"
v-model="scope.row.test_user" v-model="scope.row.test_user"
placeholder="检验人" v-model:label="scope.row.test_user_name"
clearable :edit="scope.row.isEdit"
filterable
:disabled="!scope.row.isEdit"
style="width: 100%" style="width: 100%"
> >
<el-option <el-table-column label="账号" prop="username"></el-table-column>
v-for="item in userList" <el-table-column label="名称" prop="name"></el-table-column>
:key="item.id" </xtSelect>
:label="item.name"
:value="item.id"
/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="val" label="备注"> <el-table-column prop="val" label="备注">
@ -215,7 +211,7 @@
> >
<el-link <el-link
type="danger" type="danger"
@click="delCheck(scope.row.id)" @click="delCheck(scope.row, scope.$index)"
style="margin-left: 2px" style="margin-left: 2px"
>删除</el-link >删除</el-link
> >
@ -266,6 +262,8 @@ export default {
}, },
data() { data() {
return { return {
apiUserObj: this.$API.system.user.list,
apiUserParams: {posts__code__contains: "check"},
addTemplate: { addTemplate: {
ftestitems: [{ test_val_json: "", check_val: "", testitem: "" ,choices:[],field_type:'',name:''}], ftestitems: [{ test_val_json: "", check_val: "", testitem: "" ,choices:[],field_type:'',name:''}],
test_date: "", //work test_date: "", //work
@ -306,7 +304,6 @@ export default {
let tags = that.materialCate; let tags = that.materialCate;
that.getTestItem(tags, that.ftestWork); that.getTestItem(tags, that.ftestWork);
that.getUserList(that.ftestWork);
}, },
methods: { methods: {
open() { open() {
@ -335,15 +332,6 @@ export default {
}); });
}, },
//
getUserList() {
let that = this;
this.$API.system.user.list
.req({ page: 0, posts__code__contains: "check" })
.then((res) => {
that.userList = res;
});
},
table_edit(row) { table_edit(row) {
this.dialog.worksave = true; this.dialog.worksave = true;
this.$nextTick(() => { this.$nextTick(() => {
@ -381,17 +369,22 @@ export default {
}); });
}, },
// //
delCheck(id) { delCheck(row, index) {
if (row.id == undefined) {
this.formTableData.splice(index, 1);
return
}
let that = this; let that = this;
that.$confirm(`确定删除吗?`, "提示", { that.$confirm(`确定删除吗?`, "提示", {
type: "warning", type: "warning",
}) })
.then(() => { .then(() => {
that.$API.qm.ftest.delete that.$API.qm.ftest.delete
.req(id) .req(row.id)
.then((res) => { .then((res) => {
that.$message.success("删除成功"); that.$message.success("删除成功");
that.getCheckList(that.ftestWork); that.getCheckList(that.ftestWork);
this.getFtestWork();
return res; return res;
}) })
.catch((err) => { .catch((err) => {
@ -400,9 +393,14 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
getFtestWork() {
let that = this;
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res;
});
},
saveCheck(row) { saveCheck(row) {
let that = this; let that = this;
console.log(row);
let index = this.formTableData.findIndex( let index = this.formTableData.findIndex(
(item) => item.id == row.id (item) => item.id == row.id
); );
@ -413,6 +411,7 @@ export default {
.then((res) => { .then((res) => {
that.formTableData[index].isEdit = false; that.formTableData[index].isEdit = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
this.getFtestWork();
}) })
.catch((err) => { .catch((err) => {
return err; return err;
@ -424,6 +423,7 @@ export default {
that.formTableData[index].isEdit = false; that.formTableData[index].isEdit = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
that.getCheckList(that.ftestWork); that.getCheckList(that.ftestWork);
this.getFtestWork();
}) })
.catch((err) => { .catch((err) => {
return err; return err;

View File

@ -23,6 +23,7 @@
clearable clearable
style="width: 100%" style="width: 100%"
@change="handleChange" @change="handleChange"
disabled="mode != 'add'"
> >
<el-option <el-option
v-for="item in options" v-for="item in options"
@ -52,16 +53,7 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24" v-if="form.type2 == 10">
<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-form-item label="合格数量">
<el-input-number <el-input-number
controls-position="right" controls-position="right"
@ -71,7 +63,7 @@
></el-input-number> ></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24" v-if="form.type2 == 10">
<el-form-item label="不合格数量"> <el-form-item label="不合格数量">
<el-input-number <el-input-number
controls-position="right" controls-position="right"
@ -83,20 +75,15 @@
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="检验人" prop="test_user"> <el-form-item label="检验人" prop="test_user">
<el-select <xtSelect
:apiObj="apiUserObj"
v-model="form.test_user" v-model="form.test_user"
placeholder="检验人" v-model:label="form.test_user_name"
clearable
filterable
style="width: 100%" style="width: 100%"
> >
<el-option <el-table-column label="账号" prop="username"></el-table-column>
v-for="item in userList" <el-table-column label="名称" prop="name"></el-table-column>
:key="item.id" </xtSelect>
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -116,6 +103,7 @@ export default {
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
return { return {
apiUserObj: this.$API.system.user.list,
loading: false, loading: false,
form: { form: {
type:'prod', type:'prod',