hberp/hb_client/src/views/qm/producttest.vue

267 lines
8.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-card style="margin-top: 2px">
<el-table
:data="wproductList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" label="序号" width="50"/>
<el-table-column label="产品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="任务编号">
<template slot-scope="scope" v-if="scope.row.subproduction_plan_">{{ scope.row.subproduction_plan_.number }}
</template>
</el-table-column>
<el-table-column label="产品名称">
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="型号规格">
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="军检结论">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
<el-tag v-if="scope.row.is_mtestok==true">合格</el-tag>
</template>
</el-table-column>
<el-table-column label="仓库">
<template slot-scope="scope" v-if="scope.row.warehouse_">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="检查表">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检查状态">
<template slot-scope="scope">{{ actstate_[scope.row.act_state]}}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])&&scope.row.act_state==30&&scope.row.is_mtested==false"
@click="handleMtest(scope)"
>军检
</el-link>
<el-link
@click="checkRecord(scope)"
>检验记录
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList.count > 0"
:total="wproductList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
<el-dialog title="军检" :visible.sync="dialogVisible">
<el-form
:model="mtestform"
label-width="130px"
label-position="right"
>
<el-form-item label="是否军检合格" prop="name">
<el-switch v-model="mtestform.is_mtestok"></el-switch>
</el-form-item>
<el-form-item label="军检备注" prop="name">
<el-input type="textarea" v-model="mtestform.remark_mtest"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submtest"> </el-button>
</div>
</el-dialog>
<el-dialog title="检验记录" :close-on-click-modal="false" :visible.sync="limitedCheckRecord">
<el-table
:data="recordList"
border
height="400"
>
<el-table-column type="index" width="50"/>
<el-table-column label="表单名称">
<template slot-scope="scope">{{ scope.row.form_.name }}</template>
</el-table-column>
<el-table-column label="检查类型">
<template slot-scope="scope">{{ checkTypes[scope.row.type] }}</template>
</el-table-column>
<el-table-column label="是否提交">
<template slot-scope="scope">
<span v-if="scope.row.is_submited">已提交</span>
<span v-else>未提交</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
@click="handleRecordDetail(scope)"
>查看
</el-link>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
</div>
</el-dialog>
<el-dialog
:title="formName"
:visible.sync="recordVisible"
:close-on-click-modal="false"
>
<el-row>
<el-col v-for="item in fieldList" :key="item.id" :span="12">
<div class="items">
<span class="itemLabel">{{item.field_name}}</span>
<span>{{item.field_value}}</span>
</div>
</el-col>
</el-row>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { getfifodetailList } from "@/api/inm";
import checkPermission from "@/utils/permission";
import { mtest,getwproductList } from "@/api/wpm";
import { getrecordformList, getrffieldList} from "@/api/mtm";
import {getTestRecord,getTestRecordItem} from "@/api/qm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
wproductList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
checkTypes: {
10: "子工序检验",
20: "工序检验",
30: "工序复检",
36: "夹层检验",
40: "成品检验",
},
actstate_: {
6: "待复检",
10: "操作进行中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
8: "操作准备中",
26: "待夹层检验",
70: "报废",
},
activeName: "1",
saleproduct: "",
dialogVisible: false,
mtestform: {
is_mtestok: false,
},
wproduct: null,
recordList: [],
fieldList: [],
is_testok: "true",
recordformList: [],
customfieldList: [],
recordform: null,
recordId: null,
fifo_detail: "",
listQueryrecordform: {
page: 0,
},
recordVisible: false,
isDisabled: false,
hasPicture: false,
dialogFormVisible: false,
dialogFormVisibles: false,
limitedCheckRecord: false,
testrecord: {},
WarehouseData: "",
formName: '项目检查表',
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
//待检成品列表
getList() {
this.listQuery.material__type = 1;
getwproductList(this.listQuery).then((response) => {
if (response.data) {
this.wproductList = response.data;
}
});
},
handleMtest(scope) {
this.saleproduct = scope.row.id;
this.dialogVisible = true;
},
submtest() {
mtest(this.saleproduct, this.mtestform).then((res) => {
if (res.code >= 200) {
this.$message.success("提交成功!");
this.dialogVisible = false;
}
});
},
//检验记录
checkRecord(scope) {
let that = this;
that.wproduct = scope.row.id;//成品ID
that.limitedCheckRecord = true;
getTestRecord({wproduct: scope.row.id, page: 0}).then(res => {
if (res.code == 200) {
that.recordList = res.data;
} else {
this.$message.error(res.msg);
}
})
},
//点击记录里的查看
handleRecordDetail(scope) {
let that = this;
that.fieldList = [];
getTestRecordItem(scope.row.id).then((res) => {
if (res.code >= 200) {
debugger;
that.recordVisible = true;
that.formName = res.data.form_.name;
that.fieldList = res.data.record_data;
}
})
},
},
};
</script>
<style scoped>
.items {
height: 35px;
line-height: 35px;
padding-left: 20px;
}
.itemLabel {
font-size: 14px;
color: #606266;
font-weight: 600;
}
</style>