hberp/hb_client/src/views/wpm/need.vue

1652 lines
56 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-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="待检半成品" name="1">
<el-card style="margin-top: 2px">
<el-input
v-model="listQuery.search"
placeholder="半成品名称/编号/子计划编号/工序"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter1"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter1"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter1"
>
重置
</el-button>
<el-table
v-loading="listLoading"
:data="wproductList.results"
border
fit
stripe
height="100"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号" prop="number">
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column
label="所在子工序"
:filters="filtersList"
:filter-method="filterTag"
filter-placement="bottom-end"
>
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['wp_test_init'])&&scope.row.test===null"
@click="handleInspection(scope,'1')"
>
检验
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'1')"
>
检验记录
</el-link>
<el-link
type="danger"
@click="handleScrapbcp(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="半成品报废" :close-on-click-modal="false" :visible.sync="dialogFormVisiblebcp">
<el-form :model="formbcp">
<el-form-item label="甩片原因" :label-width="formLabelWidth">
<el-select
style="width: 80%"
v-model="formbcp.scrap_reason"
placeholder="请甩片原因"
>
<el-option
v-for="item in scrapreason"
:key="item.lable"
:label="item.lable"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisiblebcp = false"> </el-button>
<el-button type="primary" @click="scrapesubmit"> </el-button>
</div>
</el-dialog>
</el-card>
</el-tab-pane>
<el-tab-pane label="复检半成品" name="2">
<el-card style="margin-top: 2px">
<el-input
v-model="listQuery2.search"
placeholder="半成品名称/编号/子计划编号/工序"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter2"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter2"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter2"
>
重置
</el-button>
<el-table
:data="wproductList2.results"
border
fit
stripe
height="100"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.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">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column
label="所在子工序"
:filters="filtersList"
:filter-method="filterTag"
>
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['wp_test_init'])&&scope.row.test===null"
@click="handleInspection(scope,'2')"
>检验
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'2')"
>检验记录
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList2.count > 0"
:total="wproductList2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="已合格半成品" name="3">
<el-card style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">
批量入库
</el-button>
<el-input
v-model="listQuery1.search"
placeholder="半成品名称/编号/子计划编号/工序"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter3"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter3"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter3"
>
重置
</el-button>
<el-table
ref="multipleTable"
:data="wproductList1.results"
border
fit
stripe
height="100"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号" prop="number">
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column
label="所在子工序"
:filters="filtersList"
:filter-method="filterTag"
>
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="检验员">
<template slot-scope="scope">
<span v-if="scope.row.update_by_!==null">{{scope.row.update_by_.username}}</span>
<span v-else>{{scope.row.create_by_.username}}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['wp_putins'])"
@click="handlePutin(scope)"
>
入库
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope)"
>
检验记录
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList1.count > 0"
:total="wproductList1.count"
:page.sync="listQuery1.page"
:limit.sync="listQuery1.page_size"
@pagination="getList1"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="不合格半成品" name="4">
<el-card style="margin-top: 2px">
<el-input
v-model="listQuery4.search"
placeholder="半成品名称/编号/子计划编号/工序"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter4"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter4"
>
搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter4"
>
重置
</el-button>
<el-table
:data="wproductList4.results"
border
fit
stripe
height="100"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.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 label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column
label="所在子工序"
:filters="filtersList"
:filter-method="filterTag"
>
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="不合格标记">
<template slot-scope="scope">
{{ ng_sign_[scope.row.ng_sign] }}
</template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column label="检验员">
<template slot-scope="scope">
<span v-if="scope.row.update_by_!==null">{{scope.row.update_by_.username}}</span>
<span v-else>{{scope.row.create_by_.username}}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['wp_scrap'])"
type="danger"
@click="handleScrap(scope)"
>
报废
</el-link>
<el-link
v-if="checkPermission(['operation_hear'])&&scope.row.ticket==null"
type="primary"
@click="handleRetrial(scope)"
>
审理
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList4.count > 0"
:total="wproductList4.count"
:page.sync="listQuery4.page"
:limit.sync="listQuery4.page_size"
@pagination="getList4"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="夹层半成品" name="5">
<el-card style="margin-top: 2px">
<el-table
:data="wproductList3.results"
border
fit
stripe
height="100"
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.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">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column
label="所在子工序"
:filters="filtersList"
:filter-method="filterTag"
>
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time">
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="scope.row.test===null&&checkPermission(['wp_test_init'])"
@click="handleInspection(scope,'3')"
>检验
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'3')"
>检验记录
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList3.count > 0"
:total="wproductList3.count"
:page.sync="listQuery3.page"
:limit.sync="listQuery3.page_size"
@pagination="getList3"
/>
</el-card>
</el-tab-pane>
</el-tabs>
<!--物料检查表&&-->
<el-dialog title="物料检查表" :close-on-click-modal="false" :visible.sync="outerVisible">
<el-select style="width: 100%" v-model="recordform" placeholder="请选择" @change="recordformChange">
<el-option
v-for="item in recordformList"
:key="item.name"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
<div slot="footer" class="dialog-footer">
<el-button @click="outerVisible = false">
</el-button>
<el-button type="primary" @click="submitrecordform(innerIndex)">填写检查项目</el-button>
</div>
</el-dialog>
<!--复检检验表单-->
<el-dialog
width="75%"
:title="formName"
@close="recordCancel"
:visible.sync="limitedReview"
:close-on-click-modal="false"
>
<reviewForm
v-if="limitedReview"
:results="fieldList"
:originList="originList"
:formID="recordform"
:hasPicture="hasPicture"
:wproduct="wproduct"
:recordId="recordId"
:isMidTesting="is_midtesting"
@recordSave="recordSave"
@recordSubmit="recordSubmit"
@recordCancel="recordCancel"
/>
</el-dialog>
<!--非复检检验表单-->
<el-dialog
width="60%"
:title="formName"
:visible.sync="recordVisible"
:close-on-click-modal="false"
@close="recordCancel"
>
<customForm
v-if="recordVisible"
:results="fieldList"
:hasPicture="hasPicture"
:formID="recordform"
:wproduct="wproduct"
:remark="remark"
:numbers="numbers"
:recordId="recordId"
:isDisabled="isDisabled"
:isMidTesting="is_midtesting"
@recordSubmit="recordSubmit"
@recordSave="recordSave"
@recordCancel="recordCancel"
/>
</el-dialog>
<!--半成品入库-->
<el-dialog title="半成品入库" :close-on-click-modal="false" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form-item label="仓库" :label-width="formLabelWidth">
<el-select
style="width: 100%"
v-model="form.warehouse"
placeholder="请选择仓库"
>
<el-option
v-for="item in WarehouseData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" :label-width="formLabelWidth">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="putin"> </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">{{ scope.row.create_by_.name }}</template>
</el-table-column>
<el-table-column label="操作时间">
<template slot-scope="scope">
<span>{{scope.row.update_time.substring(0,scope.row.update_time.length-3)}}</span>
</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
v-if="checkPermission(['wp_test_init'])&&!scope.row.is_submited"
@click="handleInspectionRecord(scope)"
>
检验
</el-link>
<el-link
v-if="scope.row.is_submited"
@click="handleRecordDetail(scope)"
>
查看
</el-link>
<el-link
v-if="checkPermission(['testrecord_delete'])"
@click="delTestRecord(scope)"
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="limitedCheckRecord = false"> </el-button>
<el-button type="primary" @click="putin"> </el-button>
</div>
</el-dialog>
<!--半成品批量入库-->
<el-dialog title="半成品批量入库" :close-on-click-modal="false" :visible.sync="dialogFormVisibles">
<el-form :model="form">
<el-form-item label="仓库" :label-width="formLabelWidth">
<el-select
style="width: 100%"
v-model="form.warehouse"
placeholder="请选择仓库"
>
<el-option
v-for="item in WarehouseData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" :label-width="formLabelWidth">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisibles = false"> </el-button>
<el-button type="primary" @click="putins"> </el-button>
</div>
</el-dialog>
<!--不合格半成品重审-->
<el-dialog title="不合格半成品重审" :close-on-click-modal="false" :visible.sync="limitedRetrial">
<el-form label-width="130px" label-position="right">
<el-form-item :label="item.field_name" v-for="item in customfieldList" :key="item.id" v-show="!item.is_hidden">
<template v-if="item.field_type=='string'">
<el-input v-model="item.default_value" :placeholder="item.description"/>
</template>
<template v-if="item.field_type==='int'">
<el-input v-model="item.default_value" type="number" :placeholder="item.description"
oninput="value=value.replace(/[^\d]/g,'')"/>
</template>
<template v-if="item.field_type==='float'">
<el-input v-model="item.default_value" type="number" :placeholder="item.description"/>
</template>
<template v-if="item.field_type==='date'">
<el-date-picker
v-model="item.default_value"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</template>
<template v-if="item.field_type==='datetime'">
<el-date-picker
v-model="item.default_value"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</template>
<template v-if="item.field_type==='select'">
<el-select style="width: 100%" v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>
</template>
<template v-if="item.field_type==='selects'">
<el-select style="width: 100%" multiple v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>
</template>
<template v-if="item.field_type==='textarea'">
<el-input type="textarea" :rows="3" v-model="item.default_value" placeholder="内容"/>
</template>
<template v-if="item.field_type==='file'">
<el-upload
ref="upload"
:action="upUrl"
:on-preview="handlePreview"
:on-success="handleUpSuccess"
:on-remove="handleRemove"
:headers="upHeaders"
:file-list="fileList"
:limit="1"
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
>
<el-button size="small" type="primary">上传文件</el-button>
</el-upload>
</template>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="limitedRetrial = false"> </el-button>
<el-button type="primary" @click="retrialSubmit"> </el-button>
</div>
</el-dialog>
<!--已完成检查表查看-->
<el-dialog
:title="formName"
:visible.sync="recordFinishedVisible"
:close-on-click-modal="false"
>
<el-row>
<el-col :span="12">
<div class="items">
<span class="itemLabel">操作人</span>
<span>{{create_by_}}</span>
</div>
</el-col>
<el-col :span="12">
<div class="items">
<span class="itemLabel">操作时间</span>
<span>{{update_time}}</span>
</div>
</el-col>
<el-col v-for="item in fieldList" :key="item.id" :span="12">
<div class="items" v-if="item.field_type!=='draw'&&item.field_value!==null&&item.field_value!==''">
<span class="itemLabel">{{item.field_name}}</span>
<span>{{item.field_value}}</span>
</div>
</el-col>
<el-col v-for="item in fieldList" :key="item.id" :span="24">
<div class="items" v-if="item.field_type==='draw'" style="height: fit-content">
<span class="itemLabel">{{item.field_name}}</span>
<img style="width: 45%;vertical-align: text-top;" :src="item.field_value"/>
</div>
</el-col>
<el-button @click="exportDom">导出</el-button>
</el-row>
</el-dialog>
<!--刷脸验证-->
<el-dialog :visible.sync="limitedPhoto" @close="closeCamera" id="loginFaceWrap">
<div style="font-size: 28px;color: #333333;text-align: center;font-weight: bold;">审核人员确认</div>
<div class="testTracking">
<faceLogin v-if="limitedPhoto" ref="faceTracking" name="faceLogin" @func="checkSubmit"></faceLogin>
</div>
</el-dialog>
</div>
</template>
<script>
import {getOrgAll} from "@/api/org";
import {getUserList} from "@/api/user";
import {getWarehouseList} from "@/api/inm";
import checkPermission from "@/utils/permission";
import customForm from '@/components/customForm/index';
import reviewForm from '@/components/customForm/review';
import faceLogin from '@/components/faceLogin/review.vue';
import {createTicket, getWorkflowInit} from "@/api/workflow";
import {getrecordformList, getrffieldList} from "@/api/mtm";
import {getwproductList, wproductPutin, createputins, testInit, scrap, getRetrial} from "@/api/wpm";
import {getTestRecord, getTestRecordItem, putTestRecordItem, delTestRecordItem, subTestRecordItem,getTestRecordExport} from "@/api/qm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
// import {saveAs} from "file-saver";
// import htmlDocx from "html-docx-js/dist/html-docx";
//import htmlToPdf from './../../utils/htmlToPdf';
const defaultetestitem = {};
export default {
inject: ['reload'],
components: {Pagination, customForm, reviewForm, faceLogin},
data() {
return {
exportFormId:null,
testitem: defaultetestitem,
formbcp: {},
form: {remark: "", warehouse: ""},
wproductList: {
count: 0,
},
wproductList1: {
count: 0,
},
wproductList2: {
count: 0,
},
wproductList3: {
count: 0,
},
wproductList4: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listQuery1: {
page: 1,
page_size: 20,
},
listQuery2: {
page: 1,
page_size: 20,
},
listQuery3: {
page: 1,
page_size: 20,
},
listQuery4: {
page: 1,
page_size: 20,
},
params: {
id: null,
is_testok: true,
record_data: null
},
activeName: "1",
create_by_: '',
update_time: '',
formLabelWidth: '',
formLabelWidthL: '',
actstate_: {
6: "待复检",
10: "操作进行中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
8: "操作准备中",
26: "待夹层检验",
70: "报废",
},
checkTypes: {
10: "子工序检验",
20: "工序检验",
30: "工序复检",
36: "夹层检验",
40: "成品检验",
},
ng_sign_: {
10: "返工",
20: "返修",
30: "报废",
40: "让步接受",
50: "偏离许可",
60: "降级使用",
70: "退回供方",
80: "召回",
},
choice: [
{
value: true,
label: "合格",
},
{
value: false,
label: "不合格",
},
],
scrapreason: [
{lable: "气泡", value: 10},
{lable: "破点", value: 20},
{lable: "划伤", value: 30},
{lable: "其他", value: 40},
],
recordList: [],
transitions: null,
options: [],
listLoading: true,
fieldList: [],
originList: [],
is_testok: "true",
field: [],
userList: [],//用户列表
orgList: [],//部门列表
recordformList: [],
customfieldList: [],
recordform: null,
recordId: null,
fifo_detail: "",
listQueryrecordform: {
page: 0,
},
recordVisible: false,
dialogFormVisiblebcp: false,
innerIndex: null,
origintest: null,
mutipID: [],
wproduct: null,
isPost: false,
limitedPhoto: false,
is_midtesting: false,
isDisabled: false,
origin_test: null,
hasPicture: false,
outerVisible: false,
innerVisible: false,
limitedReview: false,
limitedRetrial: false,
dialogFormVisible: false,
dialogFormVisibles: false,
limitedCheckRecord: false,
recordFinishedVisible: false,
testrecord: {},
retrialItem: {},//复检对象
retrialResponse: {},//复检对象
//复检表单
retrialForm: {
title: '',
transition: null,
workflow: '',
ticket_data: {},
},
WarehouseData: "",
formName: '项目检查表',
filtersList: [{text: '切割', value: '切割'}, {text: '磨边', value: '磨边'},
{text: '清洗', value: '清洗'}, {text: '热弯成型', value: '热弯成型'}, {text: '化学钢化', value: '化学钢化'},
{text: '镀膜', value: '镀膜'}, {text: '断膜', value: '断膜'}, {text: '汇流条制备', value: '汇流条制备'},
{text: '夹层', value: '夹层'}, {text: '包边', value: '包边'}],
remark:'',
numbers:null,
};
},
computed: {},
watch: {},
created() {
this.getList();//待检
this.getList2();//复检
this.getList1();//已合格
this.getList3();//夹层
this.getList4();//不合格
// this.getLists();
},
methods: {
exportDom() {
// htmlToPdf.downloadPDF(document.getElementById('pdfDom'), this.formName);
getTestRecordExport(this.exportFormId).then(res=>{
if(res.code===200){
debugger;
console.log(res.data.path)
let link = document.createElement('a');
link.href = res.data.path;
document.body.appendChild(link);
link.click();
}
})
},
checkPermission,
handleClick(tab) {
this.listLoading = true;
this.listQuery.type = tab.name;
if (tab.name == 1) {
this.getList();
} else if (tab.name == 2) {
this.getList2();
} else if (tab.name == 3) {
this.getList1();
} else if (tab.name == 4) {
this.getList4();
} else if (tab.name == 5) {
this.getList3();
}
},
//待检半成品列表
getList() {
this.listLoading = true;
this.listQuery.act_state = 20;
getwproductList(this.listQuery).then((response) => {
if (response.data) {
this.wproductList = response.data;
}
this.listLoading = false;
});
},
handleFilter1() {
this.listQuery.page = 1;
this.getList();
},
resetFilter1() {
this.listQuery = {
page: 1,
page_size: 20,
};
this.getList();
},
//待检半成品报废
handleScrapbcp(scope) {
this.dialogFormVisiblebcp = true;
this.bcpbf = scope.row.id;
},
//确定报废半成品
scrapesubmit() {
// console.log(this.formbcp);
scrap(this.bcpbf, this.formbcp).then((response) => {
if (response.code >= 200) {
this.$message.success("该半成品已报废!");
this.dialogFormVisiblebcp = false;
this.getList();
}
});
},
//复检半成品列表
getList2() {
this.listQuery2.act_state = 6;
getwproductList(this.listQuery2).then((response) => {
if (response.data) {
this.wproductList2 = response.data;
}
});
},
handleFilter2() {
this.listQuery2.page = 1;
this.getList2();
},
resetFilter2() {
this.listQuery2 = {
page: 1,
page_size: 20,
};
this.getList2();
},
//已合格半成品
getList1() {
this.listQuery1.act_state = 30;
this.listQuery1.material__type = 2;
getwproductList(this.listQuery1).then((response) => {
if (response.data) {
this.wproductList1 = response.data;
}
});
},
handleFilter3() {
this.listQuery1.page = 1;
this.getList1();
},
resetFilter3() {
this.listQuery1 = {
page: 1,
page_size: 20,
};
this.getList1();
},
//不合格半成品
getList4() {
this.listQuery4.act_state = 50;
this.listQuery4.material__type = 2;
getwproductList(this.listQuery4).then((response) => {
if (response.data) {
this.wproductList4 = response.data;
}
});
},
handleFilter4() {
this.listQuery4.page = 1;
this.getList4();
},
resetFilter4() {
this.listQuery4 = {
page: 1,
page_size: 20,
};
this.getList4();
},
//不合格半成品报废
handleScrap(scope) {
this.$confirm("确认该半成品报废?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await scrap(scope.row.id);
this.getList4();
this.$message.success("该半成品已报废!");
})
.catch((err) => {
this.$message.error(err);
});
},
//不合格产品重审展示
handleRetrial(scope) {
let that = this;
this.retrialItem = Object.assign({}, scope.row);
getRetrial(scope.row.id).then(res => {
that.retrialResponse = res.data;
getWorkflowInit(res.data.workflow).then((response) => {
if (response.data) {
that.retrialForm.transition = response.data.transitions[0].id;
that.customfieldList = response.data.field_list;
for (let i = 0; i < that.customfieldList.length; i++) {
if (that.customfieldList[i].field_key === "wproduct") {
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct;
}
if (that.customfieldList[i].field_key === "wproduct_name") {
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct_name;
}
if (that.customfieldList[i].field_key === "wproduct_type") {
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct_specification;
}
if (that.customfieldList[i].field_key === "finder") {
that.customfieldList[i].default_value = that.retrialResponse.exist_data.finder;
}
if (that.customfieldList[i].field_key === "find_process") {
that.customfieldList[i].default_value = that.retrialResponse.exist_data.find_process;
}
if (that.customfieldList[i].label === "sys_user") {
that.customfieldList[i].field_choice = that.userList;
}
if (that.customfieldList[i].label === "deptSelect") {
that.customfieldList[i].field_choice = that.orgList;
}
}
}
});
that.limitedRetrial = true;
})
},
//不合格产品重审提交
retrialSubmit() {
let that = this;
let fields = this.customfieldList;
let obj = new Object();
for (let i = 0; i < fields.length; i++) {
obj[fields[i].field_key] = fields[i].default_value
}
this.retrialForm.ticket_data = obj;
this.retrialForm.workflow = that.retrialResponse.workflow;
this.retrialForm.title = that.retrialResponse.exist_data.wproduct_name + '的重审';
createTicket(this.retrialForm).then((res) => {
if (res.code >= 200) {
this.getList4();
this.limitedRetrial = false;
this.$message.success("成功");
}
});
},
//筛选
filterTag(value, row) {
return row.step_.name === value;
},
//夹层半成品列表
getList3() {
this.listQuery3.act_state = 26;
getwproductList(this.listQuery3).then((response) => {
if (response.data) {
this.wproductList3 = response.data;
}
});
},
//半成品批量入库
handleCreate() {
this.dialogFormVisibles = true;
this.getWarehouseLists();//仓库
},
//批量入库
putins() {
let _this = this;
_this.mutipID = [];
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID.push(item.id);
});
createputins({
warehouse: this.form.warehouse,
wproducts: _this.mutipID,
remark: this.form.remark
}).then((res) => {
if (res.code >= 200) {
this.$message.success("批量入库成功!");
this.dialogFormVisibles = false;
this.getList1();
}
});
},
//仓库列表
getWarehouseLists() {
getWarehouseList({page: 0}).then((response) => {
if (response.data) {
this.WarehouseData = response.data;
}
});
},
//点击检验:如果有一个直接进入如果有多个表再进行选择
handleInspection(scope, index) {
//调该物料对应的检查表
let that = this;
that.innerIndex = index;
// this.outerVisible = true;
that.wproduct = scope.row.id;//半成品ID
this.numbers = null;
this.remark = '';
that.listQueryrecordform.material = scope.row.material;
if (index === '3') {
that.listQueryrecordform.type = 40;
} else {
that.listQueryrecordform.type = 20;
}
that.listQueryrecordform.enabled = true;
that.recordform = null;
getrecordformList(that.listQueryrecordform).then((response) => {
if (response.data) {
that.recordformList = response.data;
if (response.data.length === 1) {
that.recordform = response.data[0].id;
that.formName = response.data[0].name;
that.submitrecordform(index);
} else {
//弹出列表选择框
that.outerVisible = true;
}
}
});
},
//选择物料检查表
recordformChange() {
let that = this;
let arr = this.recordformList.filter(item => {
return item.id === that.recordform;
});
that.formName = arr[0].name;
},
//检验记录
checkRecord(scope, index) {
let that = this;
that.innerIndex = index;
that.wproduct = scope.row.id;//半成品ID
that.limitedCheckRecord = true;
getTestRecord({wproduct: scope.row.id}).then(res => {
if (res.code == 200) {
that.recordList = res.data.results;
} else {
this.$message.error(res.msg);
}
})
},
//点击记录里的检验
handleInspectionRecord(scope) {
debugger;
let that = this;
that.fieldList = [];
that.recordVisible = false;
that.recordId = scope.row.id;
that.recordform = scope.row.form;
that.numbers = scope.row.number?scope.row.number:null;
that.remark = scope.row.remark?scope.row.remark:'';
that.formName = scope.row.form_.name;
if (that.innerIndex !== '2') {//非复检
getrffieldList({form: this.recordform, enabled: true, page: 1, page_size: 100}).then((response) => {
if (response.data) {
that.hasPicture = false;
let fieldList = response.data.results;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
getTestRecordItem(scope.row.id).then((res) => {
let arr = [];
let fieldList = res.data.record_data;
that.is_midtesting = res.data.is_midtesting;
for (let i = 0; i < that.fieldList.length; i++) {
let obj = that.fieldList[i];
obj.is_testok = null;
for (let j = 0; j < fieldList.length; j++) {
if (that.fieldList[i].field_key === fieldList[j].field_key) {
obj.id = fieldList[j].id;
obj.is_testok = fieldList[j].is_testok;
obj.field_value = fieldList[j].field_value;
}
}
arr.push(obj)
}
that.fieldList = arr;
that.$nextTick(() => {
that.isDisabled = false;
that.recordVisible = true;
});
})
}
});
} else if (that.innerIndex === '2') {//复检
getTestRecordItem(scope.row.id).then((res) => {
if (res.data) {
that.hasPicture = false;
let fieldList = res.data.record_data;
that.origintest = res.data.origin_test;
that.recordform = res.data.origin_test_.form;
let originList = res.data.origin_test_.record_data;
that.originList = [...originList];
for (let i = 0; i < fieldList.length; i++) {
let obj = fieldList[i];
obj.is_testok = null;
for (let j = 0; j < originList.length; j++) {
if (fieldList[i].field_key === originList[j].field_key) {
obj.is_testok = originList[j].is_testok;
obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value;
}
}
that.fieldList.push(obj)
}
// that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
this.limitedReview = true;
}
})
}
},
//点击记录里的查看
handleRecordDetail(scope) {
let that = this;
that.fieldList = [];
that.create_by_ = scope.row.create_by_.name;
that.update_time = scope.row.update_time;
that.exportFormId = scope.row.id;
getTestRecordItem(scope.row.id).then((res) => {
if (res.code >= 200) {
that.recordFinishedVisible = true;
that.formName = res.data.form_.name;
that.fieldList = res.data.record_data;
that.numbers = res.data.number?res.data.number:'';
that.remark = res.data.remark?res.data.remark:'';
}
})
},
//半产品复检
handleReview() {
let that = this;
that.fieldList = [];
testInit({wproduct: this.wproduct, form: that.recordform}).then((response) => {
if (response.data) {
that.hasPicture = false;
that.recordId = response.data.id;
that.formName = response.data.form_.name;
let fieldList = response.data.record_data;
that.origintest = response.data.origin_test;
let originList = response.data.origin_test_.record_data;
for (let i = 0; i < fieldList.length; i++) {
let obj = fieldList[i];
obj.is_testok = null;
for (let j = 0; j < originList.length; j++) {
if (fieldList[i].field_key === originList[j].field_key) {
obj.is_testok = originList[j].is_testok;
obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value;
}
}
that.fieldList.push(obj)
}
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
this.limitedReview = true;
}
});
},
//根据选择的表渲染检查项目
submitrecordform(index) {
let that = this;
this.outerVisible = false;
that.fieldList = [];
if (that.recordform != "") {
if (index !== '2') {//非复检
testInit({wproduct: that.wproduct, form: that.recordform}).then((response) => {
if (response.data) {
that.hasPicture = false;
that.recordId = response.data.id;
getTestRecordItem(response.data.id).then((res) => {
that.formName = res.data.form_.name;
let fieldList = res.data.record_data;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
that.$nextTick(() => {
that.isDisabled = false;
that.recordVisible = true;
});
})
}
});
} else if (index === '2') {//复检
that.handleReview();
}
} else this.$message.error("请选择检查表!");
},
//半成品入库
handlePutin(scope) {
this.dialogFormVisible = true;
this.getWarehouseLists();//仓库
this.id = scope.row.id;//半成品id
},
putin() {
wproductPutin(this.id, this.form).then((res) => {
if (res.code >= 200) {
this.$message.success("入库成功!");
this.dialogFormVisible = false;
this.getList1();
}
});
},
delTestRecord(scope) {
let that = this;
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await delTestRecordItem(scope.row.id).then(res => {
if (res.code >= 200) {
that.$message.success("成功");
that.refreshRecord();
that.getList();
that.getList2();
that.getList1();
that.getList3();
} else {
this.$message.error(res.msg);
}
});
})
.catch((err) => {
this.$message.error(err);
});
},
//更新检验记录列表
refreshRecord() {
let that = this;
getTestRecord({wproduct: that.wproduct}).then(res => {
if (res.code == 200) {
that.recordList = res.data.results;
} else {
this.$message.error(res.msg);
}
})
},
//保存检查项目
recordSave(value) {
let that = this;
let id = value.id;
let params = {};
params.record_data = value.record_data;
params.is_testok = value.is_testok;
if(value.number){
params.number = value.number;
}
if(value.remark){
params.remark = value.remark;
}
putTestRecordItem(id, params).then((res) => {
if (res.code >= 200) {
that.recordVisible = false;
that.limitedReview = false;
that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord();
} else {
this.$message.error(res.msg)
}
}).catch((err) => {
this.$message.error(err);
});
},
//记录提交检查项目出现人脸验证弹窗
recordSubmit(value) {
let that = this;
let params = {};
params.id = value.id;
params.is_testok = value.is_testok;
params.record_data = value.record_data;
debugger;
if(value.number){
params.number = value.number;
}
if(value.remark){
params.remark = value.remark;
}
that.params = params;
that.limitedPhoto = true;
},
checkSubmit(data) {
debugger;
let that = this;
let id = that.params.id;
let params = new Object();
params.is_testok = that.params.is_testok;
params.record_data = that.params.record_data;
if(this.params.number){
params.number = this.params.number;
}
if(this.params.remark){
params.remark = this.params.remark;
}
params.token = data.token;
let text = '确定以操作员'+data.name+'身份提交?';
if (data.token !== '' && data.token !== null && data.token !== undefined) {
this.$confirm(text, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.limitedPhoto = false;
putTestRecordItem(id, params).then((res) => {
if (res.code >= 200) {
subTestRecordItem(id, params).then((res) => {
if (res.code >= 200) {
that.recordVisible = false;
that.limitedReview = false;
that.limitedCheckRecord = false;
that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord();
} else {
that.$message.error(res.msg)
}
}).catch(() => {});
} else {
that.$message.error(res.msg)
}
}).catch((err) => {
that.$message.error(err);
});
}).catch(() => {
that.limitedPhoto = false;
});
}
},
//第一次保存提交检查项目
recordCancel() {
this.recordVisible = false;
this.limitedReview = false;
this.getList();
this.getList2();
this.getList1();
this.getList3();
},
/*关闭相机*/
closeCamera() {
this.$refs.faceTracking.closeCamera();
let video = document.getElementById('video');
let stream = video.srcObject;
// console.log(stream);
let tracks = stream.getTracks();
tracks.forEach(track => {
track.stop()
});
video.srcObject = null;
},
},
mounted() {
getUserList({page: 0}).then(response => {
if (response.data) {
this.userList = response.data
}
});
getOrgAll().then((response) => {
this.orgList = response.data;
});
}
}
</script>
<style scoped>
.items {
height: 35px;
line-height: 35px;
padding-left: 20px;
}
.itemLabel {
font-size: 14px;
color: #606266;
font-weight: 600;
}
</style>