<template>
|
<div style="height: 100%">
|
<div class="page-header">
|
<div class="header-left">
|
<a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
|
<h2 v-if="editable">编辑-工艺文件</h2>
|
<h2 v-if="!editable">查看-工艺文件</h2>
|
</div>
|
<div class="btn-group header-right" v-if="editable">
|
<el-button @click="save()">保存</el-button>
|
</div>
|
</div>
|
<div class="page-main">
|
<div class="document-basic">
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
style="width: 100%"
|
class="l-mes"
|
:disabled="!editable"
|
label-width="110px"
|
>
|
<el-row>
|
<el-col :span="5">
|
<el-form-item prop="name" label="文件名称">
|
<el-input
|
v-model="dataForm.name"
|
placeholder="文件名称"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item prop="number" label="文件编号">
|
<el-input v-model="dataForm.number" placeholder="文件编号">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item prop="docType" label="类型">
|
<el-select
|
v-model="dataForm.docType"
|
placeholder="请选择类型"
|
style="width:100%"
|
>
|
<el-option
|
v-for="(item, index) in bomTypeDbOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3">
|
<el-form-item prop="version" label="版本号">
|
<el-input
|
v-model="dataForm.version"
|
placeholder="版本号"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<!-- <el-col :span="3">
|
<el-form-item prop="sheathColor" label="护套颜色">
|
<el-input
|
v-model="dataForm.sheathColor"
|
placeholder="护套颜色"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3">
|
<el-form-item prop="insulationColor" label="绝缘颜色">
|
<el-input
|
v-model="dataForm.insulationColor"
|
placeholder="绝缘颜色"
|
></el-input>
|
</el-form-item>
|
</el-col> -->
|
<!-- <el-col :span="4">
|
<el-form-item label="项目号" prop="projectNo">
|
<el-input
|
v-model="dataForm.projectNo"
|
placeholder="项目号"
|
></el-input>
|
</el-form-item>
|
</el-col> -->
|
<!-- <el-col :span="4">
|
<el-form-item label="项目类别" prop="projectType">
|
<el-select
|
v-model="dataForm.projectType"
|
filterable
|
placeholder="请选择"
|
style="width:100%"
|
>
|
<el-option
|
v-for="(item, index) in projectTypeOptions"
|
:label="item.name"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col> -->
|
<!-- <el-col :span="3">
|
<el-form-item label="国家" prop="country">
|
<countrySelector v-model="dataForm.country"></countrySelector>
|
</el-form-item>
|
</el-col> -->
|
</el-row>
|
<el-row>
|
<el-col :span="5">
|
<el-form-item label="产品零件号" prop="partNo">
|
<el-input v-model="dataForm.partNo" placeholder="请选择零件">
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openPartDialog()"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="7">
|
<el-form-item label="产品零件描述" prop="partName">
|
<el-input v-model="dataForm.partName" disabled> </el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="5">
|
<el-form-item label="备注" prop="remark">
|
<el-input
|
type="textarea"
|
v-model="dataForm.remark"
|
placeholder="备注"
|
style="width:360px"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
|
<div class="document-detail">
|
<el-tabs type="card" style="width: 100%;height: 100%">
|
<el-tab-pane
|
label="原材用量"
|
style="height: 100%"
|
class="orimaterial-quantity"
|
>
|
<el-card
|
shadow="never"
|
style="margin-top: 12px;border: 1px solid #cfd5de;"
|
>
|
<div slot="header">
|
<div>
|
<el-button
|
type="text"
|
size="small"
|
class="blue-but"
|
v-if="editable"
|
@click="calcMaterialCost()"
|
>计算用量
|
</el-button>
|
<el-button
|
type="text"
|
size="small"
|
@click="exportMaterialCost()"
|
>导出
|
</el-button>
|
</div>
|
</div>
|
<el-table
|
:data="materialCostList"
|
border
|
height="650"
|
:span-method="objectSpanMethod"
|
:header-cell-style="{ color: '#999' }"
|
class="document-materialcost-table"
|
show-summary
|
:summary-method="getSummaries"
|
ref="summeryTable"
|
>
|
<el-table-column
|
label="成品"
|
prop="finishedProduct"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="Bom编号"
|
prop="bomNumber"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="工序"
|
prop="operationName"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column label="物料" prop="partName" align="center">
|
</el-table-column>
|
<el-table-column label="数量" prop="quantity" align="center">
|
</el-table-column>
|
<el-table-column label="单位" prop="unit" align="center">
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</el-tab-pane>
|
<el-tab-pane
|
class="final-product-checkout"
|
label="成品检测"
|
style="height: 100%"
|
>
|
<TeststandardDialog
|
:editable="editable"
|
:documentId="Number(dataForm.id)"
|
>
|
</TeststandardDialog>
|
</el-tab-pane>
|
<el-tab-pane label="产品结构工序参数" style="height: 100%">
|
<div class="document-related-stock-part">
|
<div
|
style="padding-left:18px;font-size:14px;font-weight:700;color:#000;height:20px;line-height:20px;"
|
>
|
<span>相关库存零件</span>
|
</div>
|
<el-table
|
:data="relatedStockPartList"
|
@row-click="clickRelatedStockPart"
|
highlight-current-row
|
height="188px"
|
:header-cell-style="relatedStockPartTableHeaderCellStyle"
|
:row-style="{ height: '0' }"
|
:cell-style="{ padding: '1px' }"
|
>
|
<el-table-column
|
label="零件编号"
|
prop="partNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="零件描述"
|
prop="partName"
|
align="center"
|
width="400"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="工艺路线编号"
|
prop="routingNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="工艺路线版本"
|
prop="routingVersion"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="工艺替代号"
|
prop="routingAlternativeNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="工艺替代描述"
|
prop="routingAlternativeDesc"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="BOM号"
|
prop="bomNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="BOM版本"
|
prop="bomVersion"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="BOM替代号"
|
prop="bomAlternativeNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="BOM替代描述"
|
prop="bomAlternativeDesc"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
</el-table>
|
</div>
|
<el-card class="document-bom" header="BOM-工序参数">
|
<div slot="header">
|
<span>BOM-工序参数</span>
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="删除工艺路线"
|
placement="top-start"
|
v-if="editable"
|
style="margin-left:5px ;"
|
>
|
<el-button
|
style="float: right; padding: 3px 0px 3px 5px;color:red"
|
type="text"
|
@click="delCompleteproductstructure()"
|
>删除
|
</el-button>
|
</el-tooltip>
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="选择工艺路线"
|
placement="top-start"
|
v-if="editable"
|
>
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
@click="addTechnology()"
|
>添加
|
</el-button>
|
</el-tooltip>
|
</div>
|
<el-collapse
|
v-model="currTechnologyBomPartName"
|
accordion
|
@change="handleCompleteproductstructureChange"
|
>
|
<el-collapse-item
|
v-for="(item, i) in completeproductstructureData"
|
:key="i"
|
:name="item.bomRoutingId"
|
>
|
<template slot="title">
|
<el-checkbox
|
class="completeproductstructure-checkout"
|
v-model="item.expand"
|
disabled
|
>
|
<span style="font-weight:bold">工艺路线编号:</span
|
>{{ item.routingNo }}
|
<span style="font-weight:bold">零件号:</span
|
>{{ item.partNo }}
|
<span style="font-weight:bold">零件名称:</span
|
>{{ item.partName }}
|
<span style="font-weight:bold">Bom编号:</span
|
>{{ item.number == null ? '无' : item.number }}
|
</el-checkbox>
|
</template>
|
<div style="display:flex;">
|
<div
|
style="font-size:13px;font-weight:bold;cursor: pointer;border-radius:2px 2px 0px 0px;width:80px;text-align:center;"
|
:class="[
|
item.showBom
|
? 'highlight-tab-class'
|
: 'unhighlight-tab-class'
|
]"
|
@click="item.showBom = true"
|
>
|
BOM结构
|
</div>
|
<div
|
style="font-size:13px;font-weight:bold;cursor: pointer;margin-left: 10px;border-radius:2px 2px 0px 0px;width:80px;text-align:center;"
|
:class="[
|
!item.showBom
|
? 'highlight-tab-class'
|
: 'unhighlight-tab-class'
|
]"
|
@click="item.showBom = false"
|
>
|
工序参数
|
</div>
|
</div>
|
|
<div class="document-bom-div" v-show="item.showBom">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
content="添加或更换BOM结构"
|
placement="top-start"
|
v-if="editable"
|
style="margin-right:20px;"
|
>
|
<el-button
|
style="float: right; padding: 3px 0px;color:#67c23a"
|
type="text"
|
@click="addCompleteproductstructure()"
|
>添加
|
</el-button>
|
</el-tooltip>
|
<el-table
|
:data="item.completeproductstructureDetail"
|
row-key="id"
|
border
|
height="440"
|
default-expand-all
|
class="structure-detail-table"
|
>
|
<el-table-column prop="partNo" label="零件号" width="240">
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
label="零件名称"
|
width="400"
|
>
|
</el-table-column>
|
<el-table-column prop="qpa" label="数量" width="180">
|
</el-table-column>
|
<el-table-column prop="unit" label="单位">
|
</el-table-column>
|
</el-table>
|
</div>
|
<div class="document-technology-div" v-show="!item.showBom">
|
<div
|
style="border: 1px solid #ebeef5;height: 440px;overflow: auto;"
|
>
|
<el-collapse
|
v-model="currTechnologyOperationName"
|
accordion
|
@change="
|
handleTechnologyOperationChange(
|
$event,
|
item.bomRoutingId
|
)
|
"
|
>
|
<el-collapse-item
|
v-for="(ele, j) in item.technologyOperationData"
|
:key="j"
|
:name="ele.id"
|
>
|
<template slot="title"
|
><span style="font-weight:300"
|
> 工序名称:</span
|
>{{ ele.operationName }}
|
<span style="font-weight:300">工序编号:</span
|
>{{ ele.operationNo }}
|
</template>
|
<el-tabs v-model="activeTemplateName" type="card">
|
<el-tab-pane
|
v-for="(paramTab, index) in paramTabs"
|
:key="index"
|
:label="paramTab.label"
|
:name="paramTab.name"
|
>
|
<el-table :data="paramTab.params">
|
<el-table-column
|
prop="parameterItem"
|
label="名称"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span
|
>{{ scope.row.parameterItem }}({{
|
scope.row.unit
|
}})</span
|
>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="paramValue"
|
label="值"
|
align="center"
|
></el-table-column>
|
</el-table>
|
</el-tab-pane>
|
<el-tab-pane label="备注" style="height: 100%">
|
<rich-text
|
:editorId="
|
'fwb' + item.id + '-' + ele.id + '-' + j
|
"
|
:richContent="ele.remark"
|
></rich-text>
|
</el-tab-pane>
|
<el-tab-pane label="检测标准">
|
<checkStandardTable
|
ref="documentTestStandardTable"
|
:dataFormId="dataForm.id"
|
:routingOperationId="ele.id"
|
:operationId="ele.operationId"
|
:operationName="ele.operationName"
|
:paramTypeOptions="paramTypeOptions"
|
:bomRoutingId="
|
currTechnologyBomPart == null
|
? null
|
: currTechnologyBomPart.bomRoutingId
|
"
|
:everyBomRoutingId="item.bomRoutingId"
|
:editable="editable"
|
@refreshTestStandardInfo="
|
refreshTestStandardInfo
|
"
|
></checkStandardTable>
|
</el-tab-pane>
|
<el-tab-pane label="抽检规则">
|
<div>
|
<div style="padding: 0px 20px;">
|
<el-button
|
type="primary"
|
@click="openAddSpotCheckRuleDialog"
|
>新增</el-button
|
>
|
</div>
|
<div>
|
<el-table
|
:data="spotCheckRuleList"
|
style="width: 100%"
|
>
|
<el-table-column
|
prop="ruleNo"
|
label="规则编号"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="ruleName"
|
label="规则名称"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="samplingOperationName"
|
label="抽检工序"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="retrospectOperationName"
|
label="追溯工序"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="applyType"
|
label="检测类型"
|
align="center"
|
:formatter="applyTypeFormatter"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="measurement"
|
label="抽检比例"
|
align="center"
|
:formatter="measurementFormatter"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="samplingPosition"
|
label="抽检位置"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
width="100"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="small"
|
@click="
|
openEditSpotCheckRule(scope.row)
|
"
|
>编辑</el-button
|
>
|
<el-button
|
type="text"
|
size="small"
|
@click="delSpotCheckRule(scope.row)"
|
>删除</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
</el-collapse-item>
|
</el-collapse>
|
</div>
|
</div>
|
</el-collapse-item>
|
</el-collapse>
|
</el-card>
|
</el-tab-pane>
|
<el-tab-pane label="图片上传" style="height: 100%">
|
<el-card class="document-structure">
|
<div slot="header">
|
<span>结构图</span>
|
</div>
|
<el-upload
|
class="upload-demo"
|
action="/mes/document/uploadJgt"
|
:headers="headers"
|
:on-preview="handleStructurePreview"
|
:on-remove="handleStructureRemove"
|
:on-success="handleStructureSuccess"
|
:data="paramStructureDatas"
|
:file-list="fileStructureList"
|
:on-exceed="handleStructureExceed"
|
:before-upload="beforeStructureAvatarUpload"
|
list-type="picture"
|
multiple
|
:with-credentials="true"
|
>
|
<el-button size="small" type="primary">点击上传</el-button>
|
<div slot="tip" class="el-upload__tip">
|
只能上传jpg图片,且不超过2MB
|
</div>
|
</el-upload>
|
<el-dialog :visible.sync="dialogStructureVisible">
|
<img width="100%" :src="dialogStructureImageUrl" alt="" />
|
</el-dialog>
|
</el-card>
|
<!-- <el-card class="document-flow">
|
<div slot="header">
|
<span>流程图</span>
|
</div>
|
<span style="font-size:14px">备注:</span>
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 3, maxRows: 6 }"
|
placeholder="请输入备注内容"
|
v-model="flowRemark"
|
style="margin-bottom:10px"
|
:disabled="!editable"
|
>
|
</el-input>
|
<div style="overflow:auto;">
|
<span style="font-size:14px">节点名称:</span>
|
<el-select
|
v-model="currFlowNodeName"
|
filterable
|
placeholder="请选择"
|
@change="setCurrFlowNode"
|
style="width:80%"
|
>
|
<el-option
|
v-for="item in flowNodes"
|
:key="item.id"
|
:label="item.label"
|
:value="item.label"
|
>
|
</el-option>
|
</el-select>
|
<div id="demo" style="margin:5px auto;"></div>
|
</div>
|
<el-upload
|
class="upload-demo"
|
action="/mes/document/uploadLct"
|
:headers="headers"
|
:on-preview="handleFlowPreview"
|
:on-remove="handleFlowRemove"
|
:on-success="handleFlowSuccess"
|
:data="paramFlowDatas"
|
:file-list="fileFlowList"
|
:limit="1"
|
:on-exceed="handleFlowExceed"
|
:before-upload="beforeFlowAvatarUpload"
|
list-type="picture"
|
:with-credentials="true"
|
:disabled="!editable"
|
>
|
<el-button size="small" type="primary">点击上传</el-button>
|
<div slot="tip" class="el-upload__tip">
|
只能上传jpg图片,且不超过2MB
|
</div>
|
</el-upload>
|
<el-dialog :visible.sync="dialogFlowVisible">
|
<img width="100%" :src="dialogFlowImageUrl" alt="" />
|
</el-dialog>
|
</el-card> -->
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
</div>
|
<completeproductstructureDialog
|
:currshowlist.sync="showCompleteproductstructure"
|
:queryParam="bomQueryParam"
|
@listenToCompleteproductstructureEvent="selectCompleteproductstructure"
|
/>
|
<routingDialog
|
:currshowlist.sync="showTechnology"
|
:queryParam="queryParam"
|
@listenToRoutingEvent="selectTechnology"
|
/>
|
<qualityStandardDialog
|
:currshowlist.sync="showQualityStandard"
|
@listenToSelectTestStandardEvent="selectQualityStandard"
|
/>
|
<partDialog :currshowlist.sync="showPart" @listenToPartEvent="selectPart" />
|
<spotCheckRule
|
:currshowlist.sync="spotCheckRuleShow"
|
:docBomId="currDocBomId"
|
:routingOperationId="currRoutingOperationId"
|
:routingOperationName="currRoutingOperationName"
|
@refreshSpotCheckRuleList="refreshSpotCheckRuleList"
|
/>
|
<spotCheckRuleEdit
|
:currshowlist.sync="editSpotCheckRuleShow"
|
:documentSamplingRuleId="currDocumentSamplingRuleId"
|
@refreshSpotCheckRuleList="refreshSpotCheckRuleList"
|
/>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getObj,
|
addObj,
|
putObj,
|
saveBom,
|
getTemplateAndParam,
|
deleteBom,
|
saveTestStandard,
|
calcMaterialCost,
|
exportMaterialCost,
|
removeUploadJgt,
|
removeUploadLct,
|
saveLctJson,
|
getLctJson,
|
routingChildCheck,
|
qryDocSamplingRule
|
} from '@/api/technology/document'
|
import { delDocumentSamplingRule } from '@/api/quality/documentsamplingrule'
|
import { getObj as getTechnologyDetail } from '@/api/technology/routing'
|
import { getObj as getStructureDetail } from '@/api/technology/completeproductstructure'
|
import { getTestStandardParams } from '@/api/quality/teststandard'
|
import { remote } from '@/api/admin/dict'
|
import { fetchList as getStandard } from '@/api/quality/standardbind'
|
import { getStore } from '@/util/store.js'
|
import completeproductstructureDialog from '@/views/common/completeproductstructure.vue'
|
import routingDialog from '@/views/common/routing.vue'
|
import qualityStandardDialog from '@/views/common/teststandardradio.vue'
|
import countrySelector from '@/views/common/country'
|
import RichText from '@/views/common/rich-text.vue'
|
import TeststandardDialog from './teststandard'
|
import partDialog from '@/views/common/part.vue'
|
import checkStandardTable from './checkStandardTable'
|
import spotCheckRule from './spotCheckRule'
|
import spotCheckRuleEdit from './spotCheckRuleEdit'
|
|
export default {
|
data() {
|
return {
|
operationPart: {},
|
showCompleteproductstructure: false,
|
showTechnology: false,
|
showQualityStandard: false,
|
queryParam: {},
|
bomQueryParam: {},
|
currTechnologyName: null,
|
currTechnologyBomPartName: null,
|
currTechnologyBomPart: null,
|
completeproductstructureData: [],
|
completeproductstructureDetail: [],
|
currTechnologyOperationName: null,
|
currTechnologyOperation: null,
|
technologyOperationData: [],
|
activeTemplateName: null,
|
paramTabs: [],
|
qualityStandardList: [],
|
standardParamList: [],
|
materialCostList: [],
|
rowColSplitNodes: [],
|
projectTypeOptions: [
|
{ name: '国内项目', value: 0 },
|
{ name: '特缆研发项目', value: 1 }
|
],
|
dataForm: {
|
id: null,
|
number: null,
|
name: null,
|
version: null,
|
projectNo: null,
|
projectType: null,
|
country: null,
|
state: null,
|
remark: null,
|
partNo: null,
|
partId: null,
|
partName: null,
|
docType: 'M',
|
insulationColor: null,
|
sheathColor: null,
|
testStandard: false,
|
updateRealUser: null,
|
updateRealTime: null
|
},
|
dataRule: {
|
name: [
|
{ required: true, message: '文件名称不能为空', trigger: 'blur' }
|
],
|
version: [
|
{ required: true, message: '版本号不能为空', trigger: 'blur' }
|
],
|
projectNo: [
|
{ required: true, message: '项目号不能为空', trigger: 'blur' }
|
],
|
projectType: [
|
{ required: true, message: '项目类别不能为空', trigger: 'change' }
|
],
|
country: [{ required: true, message: '国家不能为空', trigger: 'blur' }],
|
partNo: [
|
{ required: true, message: '产品零件号不能为空', trigger: 'blur' }
|
],
|
docType: [{ required: true, message: '类型不能为空', trigger: 'blur' }]
|
},
|
fileStructureList: [],
|
headers: {
|
Authorization: 'Bearer ' + getStore({ name: 'access_token' })
|
},
|
paramStructureDatas: { documentId: null },
|
dialogStructureImageUrl: '',
|
dialogStructureVisible: false,
|
fileFlowList: [],
|
paramFlowDatas: { documentId: null, lctRemark: null },
|
dialogFlowImageUrl: '',
|
dialogFlowVisible: false,
|
flowRemark: null,
|
flowTemp: null,
|
currFlowNodeName: null,
|
curFlowNodeId: null,
|
curFlowNodeType: null,
|
flowNodes: [],
|
showPart: false,
|
relatedStockPartList: [],
|
currRelatedStockPart: null,
|
paramTypeOptions: [],
|
operationTestStandardList: [],
|
bomTypeDbOptions: [],
|
spotCheckRuleList: [],
|
spotCheckRuleShow: false,
|
currDocBomId: null,
|
currRoutingOperationId: null,
|
currRoutingOperationName: null,
|
editSpotCheckRuleShow: false,
|
currDocumentSamplingRuleId: null,
|
reportTypeOptions: []
|
}
|
},
|
components: {
|
TeststandardDialog,
|
completeproductstructureDialog,
|
routingDialog,
|
qualityStandardDialog,
|
countrySelector,
|
RichText,
|
partDialog,
|
checkStandardTable,
|
spotCheckRule,
|
spotCheckRuleEdit
|
},
|
computed: {
|
editable: function() {
|
if (!this.dataForm.id) {
|
return true
|
}
|
if (this.dataForm.id && this.dataForm.state === '01draft') {
|
return true
|
}
|
return false
|
}
|
},
|
|
created() {
|
this.dataForm.id = this.$route.query.id
|
this.init()
|
this.getDict()
|
this.getBomTypeDbOptions()
|
this.initReportTypeSelect()
|
},
|
mounted() {
|
window.addEventListener(
|
'hashchange',
|
() => {
|
const currentPath = window.location.hash.slice(1)
|
if (this.$route.path !== currentPath) {
|
this.$router.push(currentPath)
|
}
|
},
|
false
|
)
|
// 将该方法暴露至全局,js可调用
|
window.winDbClick = this.getDbClick
|
// 初始化流程图实例
|
this.initFlowDesign()
|
},
|
methods: {
|
// 查询类型字典
|
getBomTypeDbOptions() {
|
remote('bom_type_db').then((response) => {
|
if (response.data.code === 0) {
|
this.bomTypeDbOptions = response.data.data
|
} else {
|
this.bomTypeDbOptions = []
|
}
|
})
|
},
|
getDict() {
|
remote('document_flow_node').then((response) => {
|
if (response.data.code === 0) {
|
this.flowNodes = response.data.data
|
} else {
|
this.flowNodes = []
|
}
|
})
|
},
|
initFlowDesign() {
|
var property = {
|
width: 990,
|
height: 400,
|
toolBtns: ['chat', 'start'],
|
haveHead: true,
|
headLabel: true,
|
headBtns: ['save', 'print', 'reload'], // 如果haveHead=true,则定义HEAD区的按钮
|
haveTool: true,
|
haveGroup: false,
|
useOperStack: true
|
}
|
var toolBtnRemark = {
|
cursor: '选择指针',
|
direct: '结点连线',
|
chat: '流程节点',
|
start: '标题'
|
}
|
|
var _this = this
|
_this.flowTemp = $.createGooFlow($('#demo'), property)
|
_this.flowTemp.setTitle('流程图')
|
_this.flowTemp.setNodeRemarks(toolBtnRemark)
|
var headNodes = _this.flowTemp.$head[0].childNodes
|
for (let i = 0; i < headNodes.length; i++) {
|
if (headNodes[i].outerHTML.indexOf('save') > 0) {
|
headNodes[i].title = '保存流程图'
|
} else if (headNodes[i].outerHTML.indexOf('reload') > 0) {
|
headNodes[i].title = '重置流程图'
|
} else if (headNodes[i].outerHTML.indexOf('print') > 0) {
|
headNodes[i].title = '导出流程图'
|
}
|
}
|
// flowTemp.loadData(jsondata)
|
// 保存按钮事件
|
_this.flowTemp.onBtnSaveClick = function() {
|
_this.saveFlow()
|
}
|
// 重置按钮事件
|
_this.flowTemp.onFreshClick = function() {
|
_this.getFlow()
|
}
|
// 打印按钮事件
|
_this.flowTemp.onPrintClick = function() {
|
_this.flowTemp.exportDiagram('流程图')
|
}
|
},
|
// 设置当前选中节点的名称
|
setCurrFlowNode(val) {
|
this.flowTemp.setName(this.curFlowNodeId, val, 'node')
|
},
|
// 双击节点时触发
|
getDbClick(text, id) {
|
this.currFlowNodeName = text
|
this.curFlowNodeId = id
|
},
|
// 保存流程图
|
saveFlow() {
|
if (this.editable) {
|
this.flowTemp.generateDiagramBase64(this.callBackSave)
|
} else {
|
this.$message.error('该状态下的工艺文件不可进行流程图的保存')
|
}
|
},
|
callBackSave(image) {
|
if (this.dataForm.id) {
|
const flowObj = {
|
id: this.dataForm.id,
|
lctRemark: this.flowRemark,
|
lctJson: JSON.stringify(this.flowTemp.exportData()),
|
lctBase64: image
|
}
|
saveLctJson(flowObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
this.$message.success('保存流程图成功')
|
} else {
|
this.$message.error('保存流程图失败')
|
}
|
})
|
} else {
|
this.$message.error('请先保存工艺文件信息')
|
}
|
},
|
// 查询获取流程图
|
getFlow() {
|
if (this.dataForm.id) {
|
getLctJson(this.dataForm.id).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
if (data.data != null) {
|
this.flowTemp.clearData()
|
this.flowTemp.loadData(JSON.parse(data.data))
|
}
|
} else {
|
this.$message.error('重置流程图失败')
|
}
|
})
|
}
|
},
|
// 打开产品零件选择框
|
openPartDialog() {
|
this.showPart = true
|
},
|
// 选择产品零件,确认回调
|
selectPart(param, nodePart, index) {
|
if (typeof param !== 'undefined') {
|
this.dataForm.partId = param.id
|
this.dataForm.partName = param.partName
|
this.dataForm.partNo = param.partNo
|
}
|
},
|
save() {
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
putObj(this.dataForm).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
// this.setDataForm(data.data)
|
this.initOperateData()
|
this.getDocumentInfo(this.dataForm.id)
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
} else {
|
addObj(this.dataForm).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
// this.setDataForm(data.data)
|
this.getDocumentInfo(data.data.id)
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
}
|
}
|
})
|
},
|
// 对dataForm进行赋值
|
setDataForm(data) {
|
if (data != null) {
|
this.dataForm.id = data.id
|
this.dataForm.number = data.number
|
this.dataForm.name = data.name
|
this.dataForm.version = data.version
|
this.dataForm.projectNo = data.projectNo
|
this.dataForm.projectType = data.projectType
|
this.dataForm.country = data.country
|
this.dataForm.state = data.state
|
this.dataForm.remark = data.remark
|
this.dataForm.partNo = data.partNo
|
this.dataForm.partName = data.partName
|
this.dataForm.partId = data.partId
|
this.dataForm.docType = data.docType
|
this.dataForm.sheathColor = data.sheathColor
|
this.dataForm.insulationColor = data.insulationColor
|
this.dataForm.testStandard = data.testStandard
|
this.dataForm.updateRealUser = data.updateRealUser
|
this.dataForm.updateRealTime = data.updateRealTime
|
} else {
|
this.dataForm.id = null
|
this.dataForm.number = null
|
this.dataForm.name = null
|
this.dataForm.version = null
|
this.dataForm.projectNo = null
|
this.dataForm.projectType = null
|
this.dataForm.country = null
|
this.dataForm.state = null
|
this.dataForm.remark = null
|
this.dataForm.partNo = null
|
this.dataForm.partName = null
|
this.dataForm.partId = null
|
this.dataForm.docType = 'M'
|
this.dataForm.sheathColor = null
|
this.dataForm.insulationColor = null
|
this.dataForm.testStandard = false
|
this.dataForm.updateRealUser = null
|
this.dataForm.updateRealTime = null
|
}
|
},
|
// 初始化页面已操作数据
|
initOperateData() {
|
this.currTechnologyName = null
|
this.currTechnologyBomPartName = null
|
this.currTechnologyBomPart = null
|
this.currTechnologyOperationName = null
|
this.currTechnologyOperation = null
|
this.currRelatedStockPart = null
|
},
|
addCompleteproductstructure() {
|
this.bomQueryParam = {
|
partId: this.currTechnologyBomPart.partId
|
}
|
this.showCompleteproductstructure = true
|
},
|
delCompleteproductstructure() {
|
if (this.dataForm.id) {
|
if (this.currTechnologyName != null && this.currTechnologyName !== '') {
|
// 当用户删除工艺文件中关联的工艺路线时,若该文件对应BOM中所需半成品的工艺路线也已与当前工艺文件关联
|
routingChildCheck(this.currTechnologyBomPartName).then((res) => {
|
console.log('res', res.data)
|
const resData = res.data
|
let num = 0
|
if (resData.code === 0) {
|
num = resData.data
|
if (num > 0) {
|
this.$confirm(
|
'是否也将其子件的工艺、BOM数据从本工艺文件中删除?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
}
|
).then(() => {
|
this.delBomTech()
|
})
|
} else {
|
this.delBomTech()
|
}
|
}
|
})
|
} else {
|
this.$message.error('请先选择需删除的工艺路线BOM')
|
}
|
} else {
|
this.$message.error('请先填写主表信息')
|
}
|
},
|
delBomTech() {
|
const bomObj = {
|
documentId: this.dataForm.id,
|
routingId: this.currTechnologyName,
|
id: this.currTechnologyBomPartName
|
}
|
deleteBom(bomObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const bomRoutingParts = data.data.bomRoutingParts
|
const bomRoutings = data.data.bomRoutings
|
// 将返回的信息放入进completeproductstructureData中,
|
// 将返回的信息放入进relatedStockPartList中,
|
this.completeproductstructureData = []
|
if (bomRoutings.length > 0) {
|
let completeproductstructure
|
bomRoutings.forEach((item) => {
|
completeproductstructure = {
|
id: item.bomId,
|
number: item.bomNumber,
|
partNo: item.partNo,
|
partName: item.partName,
|
partId: item.partId,
|
expand: false,
|
routingId: item.routingId,
|
routingNo: item.routingNo,
|
bomRoutingId: item.id,
|
showBom: true,
|
completeproductstructureDetail: [],
|
technologyOperationData: []
|
}
|
this.completeproductstructureData.push(completeproductstructure)
|
})
|
}
|
|
this.relatedStockPartList = []
|
if (bomRoutingParts.length > 0) {
|
let relatedStockPart
|
|
bomRoutingParts.forEach((item) => {
|
relatedStockPart = {
|
id: item.id,
|
partId: item.partId,
|
partNo: item.partNo,
|
partName: item.partName,
|
routingNo: item.routingNo,
|
routingVersion: item.routingVersion,
|
routingAlternativeNo: item.routingAlternativeNo,
|
routingAlternativeDesc: item.routingAlternativeDesc,
|
bomNo: item.bomNumber,
|
bomVersion: item.bomVersion,
|
bomAlternativeNo: item.bomAlternativeNo,
|
bomAlternativeDesc: item.bomAlternativeDesc
|
}
|
this.relatedStockPartList.push(relatedStockPart)
|
})
|
}
|
this.currRelatedStockPart = null
|
this.currTechnologyName = null
|
this.currTechnologyBomPartName = null
|
this.currTechnologyBomPart = null
|
this.$message.success('删除工艺路线BOM成功')
|
} else {
|
this.$message.error('删除工艺路线BOM失败')
|
}
|
})
|
},
|
// 将选中Bom进行绑定,并将此Bom渲染到页面
|
selectCompleteproductstructure(row) {
|
if (this.dataForm.id) {
|
const bomObj = {
|
documentId: this.dataForm.id,
|
bomId: row.id,
|
routingId: this.currTechnologyName,
|
id: this.currTechnologyBomPartName
|
}
|
saveBom(bomObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const bomRoutingParts = data.data.bomRoutingParts
|
const bomRoutings = data.data.bomRoutings
|
// 将返回的信息放入进completeproductstructureData中,
|
// 将返回的信息放入进relatedStockPartList中,
|
this.completeproductstructureData = []
|
if (bomRoutings.length > 0) {
|
let completeproductstructure
|
bomRoutings.forEach((item) => {
|
completeproductstructure = {
|
id: item.bomId,
|
number: item.bomNumber,
|
partNo: item.partNo,
|
partName: item.partName,
|
partId: item.partId,
|
expand: false,
|
routingId: item.routingId,
|
routingNo: item.routingNo,
|
bomRoutingId: item.id,
|
showBom: true,
|
completeproductstructureDetail: [],
|
technologyOperationData: []
|
}
|
this.completeproductstructureData.push(completeproductstructure)
|
})
|
}
|
this.relatedStockPartList = []
|
if (bomRoutingParts.length > 0) {
|
let relatedStockPart
|
bomRoutingParts.forEach((item) => {
|
relatedStockPart = {
|
id: item.id,
|
partId: item.partId,
|
partNo: item.partNo,
|
partName: item.partName,
|
routingNo: item.routingNo,
|
routingVersion: item.routingVersion,
|
routingAlternativeNo: item.routingAlternativeNo,
|
routingAlternativeDesc: item.routingAlternativeDesc,
|
bomNo: item.bomNumber,
|
bomVersion: item.bomVersion,
|
bomAlternativeNo: item.bomAlternativeNo,
|
bomAlternativeDesc: item.bomAlternativeDesc
|
}
|
this.relatedStockPartList.push(relatedStockPart)
|
})
|
}
|
this.currRelatedStockPart = null
|
this.currTechnologyName = null
|
this.currTechnologyBomPartName = null
|
this.currTechnologyBomPart = null
|
this.$message.success('添加BOM成功')
|
} else {
|
this.$message.error('添加BOM失败')
|
}
|
})
|
} else {
|
this.$message.error('请先填写主表信息')
|
}
|
},
|
init() {
|
if (this.dataForm.id) {
|
this.getDocumentInfo(this.dataForm.id)
|
}
|
},
|
// 根据工艺文件id,查询工艺文件所有的信息
|
getDocumentInfo(documentId) {
|
getObj(documentId).then((response) => {
|
const resData = response.data.data
|
this.dataForm = resData
|
const bomRoutings = resData.bomRoutings
|
const testStandards = resData.testStandards
|
const materialCosts = resData.materialCosts
|
const bomRoutingParts = resData.bomRoutingParts
|
this.relatedStockPartList = []
|
// 挂相关库存零件
|
if (bomRoutingParts != null && bomRoutingParts.length > 0) {
|
let bomRoutingPart
|
for (let i = 0; i < bomRoutingParts.length; i++) {
|
bomRoutingPart = {
|
id: bomRoutingParts[i].id,
|
partId: bomRoutingParts[i].partId,
|
partNo: bomRoutingParts[i].partNo,
|
partName: bomRoutingParts[i].partName,
|
routingNo: bomRoutingParts[i].routingNo,
|
routingVersion: bomRoutingParts[i].routingVersion,
|
routingAlternativeNo: bomRoutingParts[i].routingAlternativeNo,
|
routingAlternativeDesc: bomRoutingParts[i].routingAlternativeDesc,
|
bomNo: bomRoutingParts[i].bomNumber,
|
bomVersion: bomRoutingParts[i].bomVersion,
|
bomAlternativeNo: bomRoutingParts[i].bomAlternativeNo,
|
bomAlternativeDesc: bomRoutingParts[i].bomAlternativeDesc
|
}
|
this.relatedStockPartList.push(bomRoutingPart)
|
}
|
}
|
this.completeproductstructureData = []
|
// 挂工艺路线
|
if (bomRoutings != null && bomRoutings.length > 0) {
|
let completeproductstructure
|
for (let i = 0; i < bomRoutings.length; i++) {
|
completeproductstructure = {
|
id: bomRoutings[i].bomId,
|
number: bomRoutings[i].bomNumber,
|
partNo: bomRoutings[i].partNo,
|
partName: bomRoutings[i].partName,
|
partId: bomRoutings[i].partId,
|
expand: false,
|
routingId: bomRoutings[i].routingId,
|
routingNo: bomRoutings[i].routingNo,
|
bomRoutingId: bomRoutings[i].id,
|
showBom: true,
|
completeproductstructureDetail: [],
|
technologyOperationData: []
|
}
|
this.completeproductstructureData.push(completeproductstructure)
|
}
|
}
|
// 挂成品检测
|
this.qualityStandardList = []
|
this.standardParamList = []
|
if (testStandards != null && testStandards.length > 0) {
|
var testStandard = testStandards[0]
|
var qualityStandard = {
|
standardNo: null,
|
standardName: null,
|
remark: null,
|
id: testStandard.testStandardId
|
}
|
this.qualityStandardList.push(qualityStandard)
|
this.getTestStandardParamData(testStandard.testStandardId)
|
}
|
// 挂原材料用量
|
this.materialCostList = []
|
if (materialCosts != null) {
|
this.calcRowColSplitNode(materialCosts)
|
}
|
// 挂结构图
|
this.fileStructureList = []
|
if (resData.jgtList != null && resData.jgtList.length > 0) {
|
for (let i = 0; i < resData.jgtList.length; i++) {
|
var aa = {
|
id: resData.jgtList[i].id,
|
name: '预览大图',
|
url: '/mes/document/file/' + resData.jgtList[i].fileName
|
}
|
this.fileStructureList.push(aa)
|
}
|
}
|
// 挂流程图
|
this.fileFlowList = []
|
if (resData.lct != null) {
|
this.fileFlowList.push({
|
name: '预览大图',
|
url: '/mes/document/file/' + resData.lct
|
})
|
}
|
// 挂流程图
|
if (resData.lctJson != null) {
|
this.flowTemp.loadData(JSON.parse(resData.lctJson))
|
this.flowRemark = resData.lctRemark
|
}
|
})
|
},
|
handleCompleteproductstructureChange(val) {
|
if (val != null && val !== '') {
|
this.currTechnologyBomPart = this.completeproductstructureData.find(
|
(item) => {
|
return item.bomRoutingId === this.currTechnologyBomPartName
|
}
|
)
|
this.currTechnologyName = this.currTechnologyBomPart.routingId
|
let currSelectBomId = null
|
let currRoutingId = null
|
for (let i = 0; i < this.completeproductstructureData.length; i++) {
|
if (
|
this.completeproductstructureData[i].bomRoutingId ==
|
this.currTechnologyBomPart.bomRoutingId
|
) {
|
this.completeproductstructureData[i].expand = true
|
currSelectBomId = this.completeproductstructureData[i].id
|
currRoutingId = this.completeproductstructureData[i].routingId
|
} else {
|
this.completeproductstructureData[i].expand = false
|
}
|
}
|
// 若已有绑定Bom结构则查,没有则不查
|
this.currTechnologyBomPart.completeproductstructureDetail = []
|
if (currSelectBomId != null) {
|
getStructureDetail(currSelectBomId).then((response) => {
|
var resultData = response.data.data
|
this.currTechnologyBomPart.completeproductstructureDetail.push(
|
resultData.tree
|
)
|
})
|
}
|
|
// 若已有绑定工艺则查,没有则不查
|
this.currTechnologyOperationName = null
|
this.currTechnologyBomPart.technologyOperationData = []
|
if (currRoutingId != null) {
|
getTechnologyDetail(currRoutingId).then((response) => {
|
const res = response.data
|
if (res.code === 0) {
|
if (res.data.operations.length > 0) {
|
const operations = res.data.operations
|
let technologyOperation
|
for (let i = 0; i < operations.length; i++) {
|
technologyOperation = {}
|
technologyOperation.id = operations[i].id
|
technologyOperation.operationName =
|
operations[i].operationName
|
technologyOperation.operationNo = operations[i].operationNo
|
technologyOperation.partName = operations[i].partName
|
technologyOperation.operationId = operations[i].operationId
|
technologyOperation.partId = operations[i].partId
|
this.currTechnologyBomPart.technologyOperationData.push(
|
technologyOperation
|
)
|
}
|
|
this.$nextTick(() => {
|
this.currTechnologyBomPart.technologyOperationData.forEach(
|
(item) => {
|
const op = operations.find((el) => {
|
return item.id === el.id
|
})
|
if (op) {
|
item.remark = op.remark
|
}
|
}
|
)
|
})
|
}
|
}
|
})
|
}
|
} else {
|
this.currTechnologyName = null
|
this.currTechnologyBomPart = null
|
for (let i = 0; i < this.completeproductstructureData.length; i++) {
|
this.completeproductstructureData[i].expand = false
|
}
|
}
|
},
|
// 添加工艺,弹出工艺选择列表对话框
|
addTechnology() {
|
if (this.dataForm.id) {
|
if (this.currRelatedStockPart != null) {
|
this.queryParam = {
|
partId: this.currRelatedStockPart.partId,
|
state: '02accepted'
|
}
|
this.showTechnology = true
|
} else {
|
this.$message.warning('请先选中相关库存零件')
|
}
|
} else {
|
this.$message.error('请先填写主表信息')
|
}
|
},
|
handleTechnologyOperationChange(val, bomRoutingId) {
|
if (val != null && val !== '') {
|
const currCompleteproductstructureData = this.completeproductstructureData.find(
|
(item) => {
|
return item.bomRoutingId === bomRoutingId
|
}
|
)
|
this.currTechnologyOperation = currCompleteproductstructureData.technologyOperationData.find(
|
(item) => {
|
return this.currTechnologyOperationName == item.id
|
}
|
)
|
this.paramTabs = []
|
getTemplateAndParam(val).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
const datas = resData.data
|
if (datas != null && datas.length > 0) {
|
this.activeTemplateName = datas[0].operationTemplateName + '_0'
|
let paramTab
|
for (let i = 0; i < datas.length; i++) {
|
paramTab = {}
|
paramTab.label = datas[i].operationTemplateName
|
paramTab.name = datas[i].operationTemplateName + '_' + i
|
paramTab.params = datas[i].paramList
|
this.paramTabs.push(paramTab)
|
}
|
}
|
}
|
})
|
// 查询检测类型字典
|
remote('quality_param_type').then((response) => {
|
if (response.data.code === 0) {
|
this.paramTypeOptions = response.data.data
|
}
|
})
|
// 根据工序、零件,查询出检测标准
|
// getStandard(
|
// Object.assign(
|
// {
|
// current: 1,
|
// size: 100
|
// },
|
// {
|
// operationId: this.currTechnologyOperation.operationId,
|
// partId: this.currTechnologyOperation.partId
|
// }
|
// )
|
// ).then((response) => {
|
// if (response.data.code === 0) {
|
// this.operationTestStandardList = response.data.data.records
|
// }
|
// })
|
// 查询抽检规则数据
|
this.currDocBomId = currCompleteproductstructureData.bomRoutingId
|
this.currRoutingOperationId = val
|
this.currRoutingOperationName = this.currTechnologyOperation.operationName
|
qryDocSamplingRule({
|
docBomId: currCompleteproductstructureData.bomRoutingId,
|
routingOperationId: val
|
}).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.spotCheckRuleList = resData.data
|
}
|
})
|
} else {
|
this.currTechnologyOperation = null
|
}
|
},
|
refreshSpotCheckRuleList() {
|
this.spotCheckRuleList = []
|
qryDocSamplingRule({
|
docBomId: this.currDocBomId,
|
routingOperationId: this.currRoutingOperationId
|
}).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.spotCheckRuleList = resData.data
|
}
|
})
|
},
|
openEditSpotCheckRule(row) {
|
this.currDocumentSamplingRuleId = row.id
|
this.editSpotCheckRuleShow = true
|
},
|
delSpotCheckRule(row) {
|
delDocumentSamplingRule(row.id).then((response) => {
|
this.$message.success('删除成功')
|
this.refreshSpotCheckRuleList()
|
})
|
},
|
measurementFormatter(row) {
|
return row.samplingNumerator + '/' + row.samplingDenominator
|
},
|
applyTypeFormatter(row) {
|
const applyType = row.applyType
|
let applyTypeDesc = ''
|
if (applyType != null) {
|
const reportTypeOption = this.reportTypeOptions.find((item) => {
|
return item.value == applyType
|
})
|
if (reportTypeOption) {
|
applyTypeDesc = reportTypeOption.label
|
}
|
}
|
return applyTypeDesc
|
},
|
// 选中工艺,后台自动保存绑定工艺与bom的关系,并返回绑定信息
|
selectTechnology(row) {
|
const bomObj = {
|
documentId: this.dataForm.id,
|
routingId: row.id,
|
id: this.currRelatedStockPart.id
|
}
|
saveBom(bomObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
const bomRoutingParts = data.data.bomRoutingParts
|
const bomRoutings = data.data.bomRoutings
|
// 将返回的信息放入进completeproductstructureData中,
|
// 将返回的信息放入进relatedStockPartList中,
|
this.completeproductstructureData = []
|
if (bomRoutings.length > 0) {
|
let completeproductstructure
|
bomRoutings.forEach((item) => {
|
completeproductstructure = {
|
id: item.bomId,
|
number: item.bomNumber,
|
partNo: item.partNo,
|
partName: item.partName,
|
partId: item.partId,
|
expand: false,
|
routingId: item.routingId,
|
routingNo: item.routingNo,
|
bomRoutingId: item.id,
|
showBom: true,
|
completeproductstructureDetail: [],
|
technologyOperationData: []
|
}
|
this.completeproductstructureData.push(completeproductstructure)
|
})
|
}
|
this.relatedStockPartList = []
|
if (bomRoutingParts.length > 0) {
|
let relatedStockPart
|
bomRoutingParts.forEach((item) => {
|
relatedStockPart = {
|
id: item.id,
|
partId: item.partId,
|
partNo: item.partNo,
|
partName: item.partName,
|
routingNo: item.routingNo,
|
routingVersion: item.routingVersion,
|
routingAlternativeNo: item.routingAlternativeNo,
|
routingAlternativeDesc: item.routingAlternativeDesc,
|
bomNo: item.bomNumber,
|
bomVersion: item.bomVersion,
|
bomAlternativeNo: item.bomAlternativeNo,
|
bomAlternativeDesc: item.bomAlternativeDesc
|
}
|
this.relatedStockPartList.push(relatedStockPart)
|
})
|
}
|
this.currRelatedStockPart = null
|
this.currTechnologyName = null
|
this.currTechnologyBomPartName = null
|
this.currTechnologyBomPart = null
|
this.$message.success('添加工艺成功')
|
} else {
|
this.$message.error('添加工艺失败')
|
}
|
})
|
},
|
addQualityStandard() {
|
if (this.dataForm.id) {
|
this.showQualityStandard = true
|
} else {
|
this.$message.error('请先填写主表信息')
|
}
|
},
|
selectQualityStandard(row) {
|
if (row != null) {
|
// 保存检测标准,查询检测项
|
var qualityStandardObj = {
|
documentId: this.dataForm.id,
|
testStandardId: row.id
|
}
|
var qualityStandard = {
|
standardNo: row.standardNo,
|
standardName: row.standardName,
|
remark: row.remark,
|
id: row.id
|
}
|
saveTestStandard(qualityStandardObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
this.qualityStandardList = []
|
this.qualityStandardList.push(qualityStandard)
|
this.getTestStandardParamData(row.id)
|
this.$message.success('添加检测标准成功')
|
} else {
|
this.$message.error('添加检测标准失败')
|
}
|
})
|
}
|
},
|
// 获取关联的检测标准参数信息
|
getTestStandardParamData(testStandardId) {
|
this.standardParamList = []
|
getTestStandardParams(
|
Object.assign({
|
testStandardId: testStandardId
|
})
|
).then((response) => {
|
this.standardParamList = response.data.data
|
})
|
},
|
delQualityStandard() {
|
this.$confirm('确定删除检测标准?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
}).then(() => {
|
var qualityStandardObj = {
|
documentId: this.dataForm.id,
|
testStandardId: null
|
}
|
saveTestStandard(qualityStandardObj).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
this.qualityStandardList = []
|
this.standardParamList = []
|
this.$message.success('删除检测标准成功')
|
} else {
|
this.$message.error('删除检测标准失败')
|
}
|
})
|
})
|
},
|
calcMaterialCost() {
|
if (this.dataForm.id) {
|
calcMaterialCost(this.dataForm.id).then((response) => {
|
const resData = response.data
|
this.materialCostList = []
|
if (resData.code === 0) {
|
const dataMap = resData.data
|
this.calcRowColSplitNode(dataMap)
|
this.$message.success('计算用量成功')
|
} else {
|
this.$message.error('计算用量失败')
|
}
|
})
|
} else {
|
this.$message.error('请先填写主表信息')
|
}
|
},
|
calcRowColSplitNode(dataMap) {
|
let rowColSplitNode
|
let keyValues
|
let allKeyValues = []
|
let i = 0
|
this.rowColSplitNodes = []
|
for (var dataKey in dataMap) {
|
keyValues = dataMap[dataKey]
|
rowColSplitNode = {
|
key: dataKey,
|
node: i,
|
num: keyValues.length
|
}
|
this.rowColSplitNodes.push(rowColSplitNode)
|
allKeyValues = allKeyValues.concat(keyValues)
|
i = i + keyValues.length
|
}
|
this.materialCostList = allKeyValues
|
},
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
if (columnIndex === 0 || columnIndex === 1) {
|
var rowColSplitNode = this.rowColSplitNodes.find(
|
(item) => item.key == row.bomId && item.node === rowIndex
|
)
|
if (rowColSplitNode !== undefined) {
|
return {
|
rowspan: rowColSplitNode.num,
|
colspan: 1
|
}
|
} else {
|
return {
|
rowspan: 0,
|
colspan: 0
|
}
|
}
|
}
|
},
|
exportMaterialCost() {
|
exportMaterialCost(this.dataForm.id).then((res) => {
|
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
|
const downloadElement = document.createElement('a') // 新建一个DOM节点
|
const href = window.URL.createObjectURL(blob) // 创建下载的链接
|
downloadElement.href = href
|
downloadElement.download = '工艺文件原材料表.xlsx' // 下载后文件名
|
document.body.appendChild(downloadElement) // 将新增的节点挂载到页面上
|
downloadElement.click() // 点击下载
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
window.URL.revokeObjectURL(href)
|
})
|
},
|
handleStructureRemove(file) {
|
if (file.id) {
|
removeUploadJgt(file.id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('删除结构图成功')
|
} else {
|
this.$message.error('删除结构图失败')
|
}
|
})
|
}
|
},
|
handleStructurePreview(file) {
|
this.dialogStructureVisible = true
|
this.dialogStructureImageUrl = file.url
|
},
|
handleStructureSuccess(response, file, fileList) {
|
if (this.dataForm.id) {
|
this.getDocumentInfo(this.dataForm.id)
|
}
|
console.log('上传成功')
|
},
|
handleStructureExceed(files, fileList) {
|
// this.$message.warning(
|
// `当前限制选择 1 个结构图文件,本次选择了 ${
|
// files.length
|
// } 个结构图文件,共选择了 ${files.length + fileList.length} 个结构图文件`
|
// )
|
},
|
beforeStructureAvatarUpload(file) {
|
if (this.dataForm.id) {
|
this.paramStructureDatas.documentId = this.dataForm.id
|
const isJPG = file.type === 'image/jpeg'
|
const isLt2M = file.size / 1024 / 1024 < 2
|
|
if (!isJPG) {
|
this.$message.error('结构图片只能是 JPG 格式!')
|
}
|
if (!isLt2M) {
|
this.$message.error('结构图片大小不能超过 2MB!')
|
}
|
return isJPG && isLt2M
|
} else {
|
this.$message.error('请先填写主表信息')
|
return false
|
}
|
},
|
handleFlowRemove(file) {
|
removeUploadLct(this.dataForm.id).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.$message.success('删除流程图成功')
|
} else {
|
this.$message.error('删除流程图失败')
|
}
|
})
|
},
|
handleFlowPreview(file) {
|
this.dialogFlowImageUrl = file.url
|
this.dialogFlowVisible = true
|
},
|
handleFlowSuccess(response, file, fileList) {
|
console.log('上传成功')
|
},
|
handleFlowExceed(files, fileList) {
|
this.$message.warning(
|
`当前限制选择 1 个流程图文件,本次选择了 ${
|
files.length
|
} 个流程图文件,共选择了 ${files.length + fileList.length} 个流程图文件`
|
)
|
},
|
beforeFlowAvatarUpload(file) {
|
if (this.dataForm.id) {
|
this.paramFlowDatas.documentId = this.dataForm.id
|
this.paramFlowDatas.lctRemark = this.flowRemark
|
/* const isJPG = file.type === 'image/jpeg'
|
const isLt2M = file.size / 1024 / 1024 < 2
|
|
if (!isJPG) {
|
this.$message.error('流程图片只能是 JPG 格式!')
|
}
|
if (!isLt2M) {
|
this.$message.error('流程图片大小不能超过 2MB!')
|
}
|
return isJPG && isLt2M */
|
} else {
|
this.$message.error('请先填写主表信息')
|
return false
|
}
|
},
|
// 点击相关库存零件行的回调
|
clickRelatedStockPart(val) {
|
this.currRelatedStockPart = val
|
},
|
// 渲染相关库存零件表的表头
|
relatedStockPartTableHeaderCellStyle({
|
row,
|
column,
|
rowIndex,
|
columnIndex
|
}) {
|
const headerStyle = 'background:#ddd;color:#000;padding:1px 0px;'
|
return headerStyle
|
},
|
getSummaries(param) {
|
const { columns, data } = param
|
console.log(columns, 'A')
|
console.log(data, 'B')
|
const sums = []
|
columns.forEach((column, index) => {
|
if (index === 0) {
|
sums[index] = '合计'
|
return
|
}
|
// const values = data.map(item => Number(item[column.property]));
|
// 筛选单位是kg的
|
const values = data.map((item) => {
|
if (item.unit == 'kg') {
|
return Number(item[column.property])
|
}
|
})
|
if (column.property == 'quantity') {
|
if (!values.every((value) => isNaN(value))) {
|
sums[index] = values.reduce((prev, curr) => {
|
const value = Number(curr)
|
if (!isNaN(value)) {
|
return Number((prev + curr).toFixed(2))
|
} else {
|
return prev
|
}
|
}, 0)
|
} else {
|
sums[index] = 0
|
}
|
} else if (column.property == 'unit') {
|
sums[index] = 'kg'
|
} else {
|
sums[index] = ''
|
}
|
})
|
|
return sums
|
},
|
refreshTestStandardInfo(testStandardInfo) {
|
if (testStandardInfo) {
|
this.dataForm.testStandard = testStandardInfo.testStandard
|
this.dataForm.updateRealUser = testStandardInfo.updateRealUser
|
this.dataForm.updateRealTime = testStandardInfo.updateRealTime
|
}
|
this.refreshSpotCheckRuleList()
|
},
|
openAddSpotCheckRuleDialog() {
|
this.spotCheckRuleShow = true
|
},
|
initReportTypeSelect() {
|
remote('apply_report_type').then((response) => {
|
const code = response.data.code
|
if (code === 0) {
|
const _data = response.data.data
|
this.reportTypeOptions = _data
|
}
|
})
|
}
|
},
|
updated() {
|
this.$nextTick(() => {
|
this.$refs.summeryTable.doLayout()
|
})
|
}
|
}
|
</script>
|
|
<style>
|
.document-detail {
|
width: 100%;
|
height: 800px;
|
padding: 10px 20px;
|
display: flex;
|
border: 1px solid #ddd;
|
background-color: #fff;
|
margin-top: 10px;
|
box-sizing: border-box;
|
}
|
|
.document-basic {
|
background-color: #fff;
|
height: 133px;
|
display: flex;
|
align-items: flex-end;
|
padding: 10px 30px;
|
border: 1px solid #ddd;
|
box-sizing: border-box;
|
}
|
|
.document-related-stock-part {
|
background-color: #fff;
|
width: 100%;
|
height: 220px;
|
border: 1px solid #ddd;
|
padding: 10px 20px 0px 20px;
|
box-sizing: border-box;
|
}
|
|
.document-bom {
|
background-color: #fff;
|
width: 100%;
|
height: 499px;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
box-sizing: border-box;
|
}
|
|
.document-bom .el-card__header {
|
padding: 1px 20px;
|
border-bottom: 0px solid #ebeef5;
|
}
|
|
.document-bom .el-card__body {
|
height: calc(100% - 22px);
|
}
|
|
.document-bom .el-card__body .el-collapse {
|
height: 100%;
|
overflow: auto;
|
}
|
|
.document-technology-params {
|
background-color: #fff;
|
width: calc(52% - 20px);
|
float: left;
|
height: 719px;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
margin-left: 20px;
|
}
|
|
.document-structure {
|
background-color: #fff;
|
width: 35%;
|
float: left;
|
height: 719px;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
box-sizing: border-box;
|
}
|
.el-card.is-always-shadow{
|
width: 100%;
|
}
|
|
.document-flow {
|
background-color: #fff;
|
width: calc(65% - 20px);
|
float: left;
|
height: 719px;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
margin-left: 20px;
|
box-sizing: border-box;
|
}
|
|
/*自定义disabled状态下checkbox的样式*/
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled.is-checked
|
.el-checkbox__inner {
|
background-color: #006eff;
|
border-color: #006eff;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled.is-checked
|
+ span.el-checkbox__label {
|
color: #006eff;
|
border-color: #006eff;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled
|
.el-checkbox__inner {
|
background-color: #ffffff;
|
cursor: pointer;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled
|
+ span.el-checkbox__label {
|
color: #606266;
|
cursor: pointer;
|
}
|
|
.completeproductstructure-checkout .el-checkbox__inner::after {
|
border: 1px solid #fff !important;
|
border-left: 0 !important;
|
border-top: 0 !important;
|
cursor: pointer !important;
|
}
|
|
.document-bom-div {
|
width: 100%;
|
margin-bottom: 5px;
|
}
|
|
.document-technology-div {
|
width: 100%;
|
margin-bottom: 5px;
|
margin-right: 10px;
|
}
|
|
.document-technology-div .el-collapse {
|
border-top: 0px;
|
border-bottom: 0px;
|
}
|
|
.structure-detail-table th.gutter {
|
display: table-cell !important;
|
width: 10px !important;
|
}
|
|
.structure-detail-table colgroup.gutter {
|
display: table-cell !important;
|
width: 10px !important;
|
}
|
|
.final-product-checkout .el-card__header {
|
padding: 0px 20px;
|
border-bottom: 0px;
|
}
|
|
.final-product-checkout .el-card__body {
|
padding: 0px 20px 20px;
|
}
|
|
.orimaterial-quantity .el-card__header {
|
padding: 0px 20px;
|
border-bottom: 0px;
|
}
|
|
.orimaterial-quantity .el-card__body {
|
padding: 0px 20px 20px;
|
}
|
|
.document-materialcost-table th.gutter {
|
display: table-cell !important;
|
width: 10px !important;
|
}
|
|
.document-materialcost-table colgroup.gutter {
|
display: table-cell !important;
|
width: 10px !important;
|
}
|
|
.GooFlow .ico .ico_start:before {
|
color: red;
|
}
|
.highlight-tab-class {
|
color: #006eff;
|
background: #e4e7ed;
|
border-top: 1px solid #006eff;
|
}
|
.unhighlight-tab-class {
|
border: 1px solid #e4e7ed;
|
border-bottom: none;
|
}
|
</style>
|