plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2252 lines
103 KiB

<template>
<div class="mod-config">
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" :model="searchData">
<el-form-item label="序列号">
<el-input v-model="searchData.referenceNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="申请人">
<el-input v-model="searchData.applicant" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button v-if="authSearch" @click="getDataList">查询</el-button>
<el-button v-if="authUpdate" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="authSearch" @click="exportHandle()">导出</el-button>
<el-button v-if="authSearch" @click="searchHandle()">搜索</el-button>
</el-form-item>
</el-form>
<!-- 列表 -->
<el-table
ref="rohsTable"
:height="height"
:data="dataList"
border
:row-style="rowStyle"
@row-click="changeClickRow"
@current-change="currentChange"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column prop="referenceNo" header-align="center" align="center" label="序列号" width="165"></el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="单据状态" width="120"></el-table-column>
<el-table-column prop="nodeId" header-align="center" align="center" label="当前节点ID" width="130"></el-table-column>
<el-table-column prop="nodeName" header-align="center" align="center" label="当前节点" width="150"></el-table-column>
<el-table-column prop="currentApprover" header-align="center" align="center" label="当前节点审批人" width="170"></el-table-column>
<el-table-column prop="applicant" header-align="center" align="center" label="申请人编码" width="130"></el-table-column>
<el-table-column prop="applicantName" header-align="center" align="center" label="申请人名称" width="150"></el-table-column>
<el-table-column prop="pm" header-align="center" align="center" label="PM编码" width="130"></el-table-column>
<el-table-column prop="pmName" header-align="center" align="center" label="PM名称" width="150"></el-table-column>
<el-table-column prop="applicationDate" header-align="center" align="center" label="申请日期" width="165"></el-table-column>
<el-table-column prop="plannedMassProductionDate" header-align="center" align="center" label="计划转量产时间" width="210"></el-table-column>
<el-table-column prop="process" header-align="center" align="center" label="工艺" width="120"></el-table-column>
<el-table-column prop="color" header-align="center" align="center" label="颜色" width="120"></el-table-column>
<el-table-column prop="vendorCode" header-align="center" align="center" label="供应商代码" width="160"></el-table-column>
<el-table-column prop="vendorMaterialCode" header-align="center" align="center" label="供应商材料编号" width="200" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="materialClassify" header-align="center" align="center" label="材料分类" width="200" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="otherMaterialClassify" header-align="center" align="center" label="其他材料分类" width="210" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="materialUseFor" header-align="center" align="center" label="辅材用途" width="180" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="endCustomer" header-align="center" align="center" label="最终客户编码" width="160"></el-table-column>
<el-table-column prop="endCustomerName" header-align="center" align="center" label="最终客户名称" width="180"></el-table-column>
<el-table-column prop="projectId" header-align="center" align="center" label="项目编码" width="140"></el-table-column>
<el-table-column prop="projectName" header-align="center" align="center" label="项目名称" width="180"></el-table-column>
<el-table-column prop="commGroup1" header-align="center" align="center" label="商品组1编码" width="170"></el-table-column>
<el-table-column prop="commGroup1Desc" header-align="center" align="center" label="商品组1名称" width="170"></el-table-column>
<el-table-column prop="commGroup2" header-align="center" align="center" label="商品组2编码" width="170"></el-table-column>
<el-table-column prop="commGroup2Desc" header-align="center" align="center" label="商品组2名称" width="170"></el-table-column>
<el-table-column prop="commGroup3" header-align="center" align="center" label="商品组3编码" width="170"></el-table-column>
<el-table-column prop="commGroup3Desc" header-align="center" align="center" label="商品组3名称" width="170"></el-table-column>
<el-table-column prop="needCreateNumber" header-align="center" align="center" label="需创建内部编号" width="200"></el-table-column>
<el-table-column prop="npdEngineer" header-align="center" align="center" label="NPD工程师编码" width="170"></el-table-column>
<el-table-column prop="npdEngineerName" header-align="center" align="center" label="NPD工程师名称" width="170"></el-table-column>
<el-table-column prop="materialValidityTime" header-align="center" align="center" label="材料有效期" width="200"></el-table-column>
<el-table-column prop="needDeviation" header-align="center" align="center" label="是否需偏差许可" width="190"></el-table-column>
<el-table-column prop="technicalPlan" header-align="center" align="center" label="技术计划编码" width="170"></el-table-column>
<el-table-column prop="technicalPlanName" header-align="center" align="center" label="技术计划名称" width="170"></el-table-column>
<el-table-column prop="buyer" header-align="center" align="center" label="采购编码" width="130"></el-table-column>
<el-table-column prop="buyerName" header-align="center" align="center" label="采购名称" width="130"></el-table-column>
<el-table-column prop="expectReportTime" header-align="center" align="center" label="报告时间(月)" width="200"></el-table-column>
<el-table-column prop="sgsReportNumber" header-align="center" align="center" label="SGS报告编号" width="190" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="expiredDate" header-align="center" align="center" label="报告日期" width="165"></el-table-column>
<el-table-column prop="validUntil" header-align="center" align="center" label="有效期" width="160"></el-table-column>
<el-table-column prop="isMeetRohsRequirement" header-align="center" align="center" label="符合RoHS" width="170"></el-table-column>
<el-table-column prop="isAhGrade" header-align="center" align="center" label="AH属性" width="140"></el-table-column>
<el-table-column prop="hsfSupplierClassification" header-align="center" align="center" label="HSF供应商等级" width="220"></el-table-column>
<el-table-column prop="isSameMaterialDiffSize" header-align="center" align="center" label="同材不同规格" width="220"></el-table-column>
<el-table-column prop="ifsPartNo" header-align="center" align="center" label="IFS编号" width="150"></el-table-column>
<el-table-column prop="remark" header-align="center" align="center" label="备注" width="220" :show-overflow-tooltip="true"></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="130" label="操作">
<template slot-scope="scope">
<el-link v-if="authUpdate && scope.row.status !== '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">编辑</el-link>
<el-link v-if="authUpdate && scope.row.status === '已完成'" style="cursor: pointer" @click="addOrUpdateHandle(scope.row)">详情</el-link>
<el-link v-if="authIssue && scope.row.status === '草稿'" style="cursor: pointer; margin-left: 10px;" @click="issueModal(scope.row)">下达</el-link>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 编辑模态框 -->
<el-dialog
:title="modalTitle"
:visible.sync="modalFlag"
width="1010px"
top="10vh"
v-drag
:close-on-click-modal="false"
:showClose="false">
<el-tabs tab-position="left" type="border-card" v-model="activeName" style="width: 100%;height: 650px;">
<!-- 基本信息 -->
<el-tab-pane label="基本信息" name="basicInfo">
<div style="height: 635px">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('applicant')" slot="label" @click="getBaseList(103, 1)"><a herf="#">申请人/Applicant</a></span>
<span v-else slot="label">申请人/Applicant</span>
<el-input v-model="modalData.applicant" @blur="applicantBlur(103)" :disabled="isRohsFieldDisabled('applicant')" style="width: 150px"></el-input>
<el-input v-model="modalData.applicantName" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="申请日期/Application Date">
<el-date-picker v-model="modalData.applicationDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('applicationDate')" style="width: 190px" :editable=false></el-date-picker>
</el-form-item>
<el-form-item label="工艺/Process">
<dict-data-select v-model="modalData.process" clearable :disabled="isRohsFieldDisabled('process')" style="width: 190px" dict-type="rohs_process"></dict-data-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="供应商代码/Vendor Code">
<el-input v-model="modalData.vendorCode" :disabled="isRohsFieldDisabled('vendorCode')" style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="供应商材料编号/Vendor Material Code" style="margin-left: -10px">
<el-input v-model="modalData.vendorMaterialCode" :disabled="isRohsFieldDisabled('vendorMaterialCode')" style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="辅材用途/Material Use For">
<el-input v-model="modalData.materialUseFor" :disabled="isRohsFieldDisabled('materialUseFor')" style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="材料分类/Material Classify">
<dict-data-select v-model="modalData.materialClassifyList" multiple :collapse-tags="true" :disabled="isRohsFieldDisabled('materialClassify')" style="width: 394px" dict-type="rohs_material_classify"></dict-data-select>
</el-form-item>
<el-form-item label="其他材料分类/Other Material Classify" v-if="modalData.materialClassifyList && modalData.materialClassifyList.includes('Other其他')">
<el-input v-model="modalData.otherMaterialClassify" :disabled="isRohsFieldDisabled('otherMaterialClassify')" style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span slot="label" v-if="!modalData.endCustomerFlag && !isRohsFieldDisabled('endCustomer')" @click="getBaseList(102, 1)"><a herf="#">最终客户/End Customer</a></span>
<span slot="label" v-else>最终客户/End Customer</span>
<el-input :disabled="modalData.endCustomerFlag || isRohsFieldDisabled('endCustomer')" readonly v-model="modalData.endCustomer" @blur="handleQueryCustomer" style="width: 150px"></el-input>
<el-input disabled v-model="modalData.endCustomerName" style="width: 240px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('pm')" slot="label" @click="getBaseList(103, 5)"><a herf="#">PM人员/PM</a></span>
<span v-else slot="label">PM人员/PM</span>
<el-input v-model="modalData.pm" @blur="pmBlur(103)" :disabled="isRohsFieldDisabled('pm')" style="width: 150px"></el-input>
<el-input v-model="modalData.pmName" disabled style="width: 240px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span slot="label" v-if="!modalData.projectIdFlag && !isRohsFieldDisabled('projectId')" @click="chooseProjectListFlag = true"><a herf="#">项目编码/Project ID</a></span>
<span slot="label" v-else>项目编码/Project ID</span>
<el-input :disabled="modalData.projectIdFlag || isRohsFieldDisabled('projectId')" readonly v-model="modalData.projectId" @blur="handleQueryProjectByCustomer" style="width: 150px"></el-input>
<el-input disabled v-model="modalData.projectName" style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="颜色/Color">
<el-input v-model="modalData.color" :disabled="isRohsFieldDisabled('color')" style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="计划转量产时间/Planned Mass Production">
<el-date-picker v-model="modalData.plannedMassProductionDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :disabled="isRohsFieldDisabled('plannedMassProductionDate')" style="width: 230px" :editable=false></el-date-picker>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup1')" slot="label" @click="getBaseList(110)"><a herf="#">商品组1 / Comm Group 1</a></span>
<span v-else slot="label">商品组1 / Comm Group 1</span>
<el-input v-model="modalData.commGroup1" @change="commGroup1Blur(110)" :disabled="isRohsFieldDisabled('commGroup1')" style="width: 150px"></el-input>
<el-input v-model="modalData.commGroup1Desc" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="是否需偏差许可/Need Deviation">
<el-radio-group v-model="modalData.needDeviation" :disabled="isRohsFieldDisabled('needDeviation')" style="width: 190px">
<el-radio label="Y" @click.native.prevent="radioClick('needDeviation', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('needDeviation', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup2')" slot="label" @click="getBaseList(111)"><a herf="#">商品组2 / Comm Group 2</a></span>
<span v-else slot="label">商品组2 / Comm Group 2</span>
<el-input v-model="modalData.commGroup2" @change="commGroup2Blur(111)" :disabled="isRohsFieldDisabled('commGroup2')" style="width: 150px"></el-input>
<el-input v-model="modalData.commGroup2Desc" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="需创建内部编号/Need Create No.">
<el-radio-group v-model="modalData.needCreateNumber" :disabled="isRohsFieldDisabled('needCreateNumber')" style="width: 190px">
<el-radio label="Y" @click.native.prevent="radioClick('needCreateNumber', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('needCreateNumber', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('commGroup3')" slot="label" @click="getBaseList(130)"><a herf="#">商品组3 / Comm Group 3</a></span>
<span v-else slot="label">商品组3 / Comm Group 3</span>
<el-input v-model="modalData.commGroup3" @change="commGroup3Blur(130)" :disabled="isRohsFieldDisabled('commGroup3')" style="width: 150px"></el-input>
<el-input v-model="modalData.commGroup3Desc" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="是否Fiber材料/Fiber Material">
<el-radio-group v-model="modalData.isFiberMaterial" :disabled="isRohsFieldDisabled('isFiberMaterial')" style="width: 190px">
<el-radio label="Y" @click.native.prevent="radioClick('isFiberMaterial', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('isFiberMaterial', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('npdEngineer')" slot="label" @click="getBaseList(103, 3)"><a herf="#">NPD工程师/NPD Engineer</a></span>
<span v-else slot="label">NPD工程师/NPD Engineer</span>
<el-input v-model="modalData.npdEngineer" @blur="npdEngineerBlur(103)" :disabled="isRohsFieldDisabled('npdEngineer')" style="width: 150px"></el-input>
<el-input v-model="modalData.npdEngineerName" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="WM所需求规格/WM Required Spec">
<el-input v-model="modalData.wmRequiredSpec" :disabled="isRohsFieldDisabled('wmRequiredSpec')" style="width: 190px"></el-input>
</el-form-item>
<el-form-item label="材料厚度/Material Thickness">
<el-input v-model="modalData.materialThickness" :disabled="isRohsFieldDisabled('materialThickness')" style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="材料有效期/Material Validity Time">
<el-date-picker v-model="modalData.materialValidityTime" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('materialValidityTime')" style="width: 190px" :editable=false></el-date-picker>
</el-form-item>
<el-form-item label="有效期备注/Validity Comments">
<el-input v-model="modalData.materialValidityComments" :disabled="isRohsFieldDisabled('materialValidityComments')" style="width: 190px"></el-input>
</el-form-item>
<el-form-item label="报告时间(月)/Expect Report Time">
<el-input class="inlineNumber numInput" v-model="modalData.expectReportTime" :disabled="isRohsFieldDisabled('expectReportTime')" type="number" style="width: 190px"></el-input>
</el-form-item>
<el-form-item label=" " style="margin-top: -2px;margin-left: 2px">
<el-button type="primary" icon="el-icon-upload" @click="uploadDialog = true">上传附件</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('technicalPlan')" slot="label" @click="getBaseList(103, 4)"><a herf="#">技术计划/Technical Plan</a></span>
<span v-else slot="label">技术计划/Technical Plan</span>
<el-input v-model="modalData.technicalPlan" @blur="technicalPlanBlur(103)" :disabled="isRohsFieldDisabled('technicalPlan')" style="width: 150px"></el-input>
<el-input v-model="modalData.technicalPlanName" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" v-if="!isRohsFieldDisabled('buyer')" slot="label" @click="getBaseList(2000, 2)"><a herf="#">采购/Buyer</a></span>
<span v-else slot="label">采购/Buyer</span>
<el-input v-model="modalData.buyer" @blur="buyerBlur(2000)" :disabled="isRohsFieldDisabled('buyer')" style="width: 150px"></el-input>
<el-input v-model="modalData.buyerName" disabled style="width: 240px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="所需审批文件/Docs Needed" >
<dict-data-select v-model="modalData.qualificationDocumentsNeededList" multiple :collapse-tags="true" :disabled="isRohsFieldDisabled('qualificationDocumentsNeeded')" style="width: 394px" dict-type="rohs_qualification_docs"></dict-data-select>
</el-form-item>
<el-form-item label="测试报告必测项/Test Items">
<dict-data-select v-model="modalData.testReportIncludingItemsList" multiple :collapse-tags="true" :disabled="isRohsFieldDisabled('testReportIncludingItems')" style="width: 394px" dict-type="rohs_test_report_items"></dict-data-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="备注说明/Remark" style="display: block;">
<el-input type="textarea" :rows="3" v-model="modalData.remark" :disabled="isRohsFieldDisabled('remark')" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<!-- HSF 填写信息 -->
<el-tab-pane label="HSF 填写信息" name="hsfInfo">
<div style="height: 635px">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item label="SGS报告编号/SGS Report Number">
<el-input v-model="modalData.sgsReportNumber" :disabled="isRohsFieldDisabled('sgsReportNumber')" style="width: 230px"></el-input>
</el-form-item>
<el-form-item label="报告日期/Expired Date">
<el-date-picker v-model="modalData.expiredDate" type="date" value-format="yyyy-MM-dd" :disabled="isRohsFieldDisabled('expiredDate')" style="width: 180px" :editable=false></el-date-picker>
</el-form-item>
<el-form-item label="有效期/Valid Until">
<dict-data-select v-model="modalData.validUntil" clearable :disabled="isRohsFieldDisabled('validUntil')" style="width: 180px" dict-type="rohs_valid_until"></dict-data-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="是否符合RoHS/Meet RoHS Req">
<el-radio-group v-model="modalData.isMeetRohsRequirement" :disabled="isRohsFieldDisabled('isMeetRohsRequirement')" style="width: 230px">
<el-radio label="Y" @click.native.prevent="radioClick('isMeetRohsRequirement', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('isMeetRohsRequirement', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="材料属性是否是AH/Is AH Grade">
<el-radio-group v-model="modalData.isAhGrade" :disabled="isRohsFieldDisabled('isAhGrade')" style="width: 180px">
<el-radio label="Y" @click.native.prevent="radioClick('isAhGrade', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('isAhGrade', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="HSF供应商等级/Supplier Class">
<el-radio-group v-model="modalData.hsfSupplierClassification" :disabled="isRohsFieldDisabled('hsfSupplierClassification')" style="width: 180px">
<el-radio label="A类" @click.native.prevent="radioClick('hsfSupplierClassification', 'A类')">A类</el-radio>
<el-radio label="B类" @click.native.prevent="radioClick('hsfSupplierClassification', 'B类')">B类</el-radio>
<el-radio label="C类" @click.native.prevent="radioClick('hsfSupplierClassification', 'C类')">C类</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="Fiber报告信息/Fiber Information" style="display: block;">
<el-input type="textarea" :rows="3" v-model="modalData.fiberInformation" :disabled="isRohsFieldDisabled('fiberInformation')" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-form v-if="shouldShowHsfStandard(modalData.endCustomer)" :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
<el-form-item label="HSF标准/HSF Standard" style="display: block;">
<el-input type="textarea" :rows="3" v-model="modalData.hsfStandard" :disabled="isRohsFieldDisabled('hsfStandard')" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<!-- NPD 信息 -->
<el-tab-pane label="NPD 信息" name="npdInfo">
<div style="height: 635px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -5px;">
<el-form-item label="现有材料不同规格/Same Material Diff Size">
<el-radio-group v-model="modalData.isSameMaterialDiffSize" :disabled="isRohsFieldDisabled('isSameMaterialDiffSize')" style="width: 190px">
<el-radio label="Y" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'Y')">是</el-radio>
<el-radio label="N" @click.native.prevent="radioClick('isSameMaterialDiffSize', 'N')">否</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData">
<el-form-item label="材料描述/Material Desc." style="display: block;">
<el-input type="textarea" :rows="3" v-model="modalData.materialDesc" :disabled="isRohsFieldDisabled('materialDesc')" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
<el-form-item label="备注说明/NPD Remark" style="display: block;">
<el-input type="textarea" :rows="3" v-model="modalData.npdRemark" :disabled="isRohsFieldDisabled('npdRemark')" resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: 50px">
<el-form-item label="TDS属性/TDS Property" style="display: block;">
<oss-components
:save-visible="authFileSave"
:download-visible="authFileDownLoad"
:remove-visible="authFileRemove"
:preview-visible="authFilePreview"
:disabled="showModalFlag || modalData.status === '已完成'"
:enable-upgrade="!showModalFlag && modalData.status !== '已完成'"
:require-file-no-rev="true"
:auto-file-no="true"
:single-upload="true"
:row-click-select="true"
:show-order-ref2="false"
label="序列号"
:height="350"
style="margin-top: 2px"
:columns="tdsFileColumnList"
:order-ref1="modalData.site || ''"
:order-ref2="modalData.referenceNo || ''"
order-ref3="tdsProperty">
</oss-components>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<!-- 材料信息 -->
<el-tab-pane label="材料信息" name="materialInfo">
<div style="height: 635px">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-top: -15px;">
<el-form-item label=" ">
<el-button type="primary" v-if="!showModalFlag && canEditRohsMaterial()" @click="openProjectMaterialDialog">新增材料</el-button>
<el-button type="danger" v-if="!showModalFlag && canEditRohsMaterial()" @click="removeSelectedMaterialRows">删除材料</el-button>
</el-form-item>
</el-form>
<el-table
ref="rohsMaterialTable"
class="rohs-material-table"
border
:data="modalData.materialList"
@selection-change="materialSelectionChange"
:header-cell-style="materialDialogHeaderCellStyle"
:height="585"
style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
<el-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" v-if="canSaveAction()" @click="dataFormSubmit()">保存</el-button>
<el-button type="primary" @click="modalFlag = false">关闭</el-button>
<el-button type="primary" v-if="canAgreeAction()" :loading="submitLoading" @click="agreeSubmit">同意</el-button>
<el-button type="primary" v-if="canRejectAction()" :loading="submitLoading" @click="openRejectModal">驳回</el-button>
</el-footer>
</el-dialog>
<upload-file-list
v-if="modalFlag"
folder="rohs"
order-ref3="rohsAttachment"
title="RoHs 附件上传"
:label="'序列号'"
:file-list.sync="fileList"
:no="modalData.referenceNo"
:upload-dialog.sync="uploadDialog"
path="/upload/test">
</upload-file-list>
<!--选择项目模态框-->
<el-dialog title="选择-项目" :close-on-click-modal="false" @close="closeProjectInfoDialog"
@open="searchProjectInfoList" :visible.sync="chooseProjectListFlag" width="35%">
<el-form label-position="top" :model="searchProjectData" ref="closeProjectInfoForm">
<el-row :gutter="10">
<el-col :span="6">
<el-form-item label="项目号">
<el-input v-model="searchProjectData.projectId"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目名称">
<el-input v-model="searchProjectData.projectName"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label=" ">
<el-button type="primary" @click="searchProjectInfoList">查询</el-button>
</el-form-item>
</el-col>
</el-row>
<el-table :height="223"
:data="projectList"
border
@row-click="projectClickRow">
<el-table-column label="项目号" prop="projectId"/>
<el-table-column label="项目名称" prop="projectName"/>
</el-table>
</el-form>
<el-footer style="height:35px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="chooseProjectListFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="选择项目物料" top="15vh" width="75%" :close-on-click-modal="false" v-drag :visible.sync="projectMaterialDialogFlag">
<el-form :inline="true" label-position="top" :model="projectMaterialSearchData">
<el-form-item label="PLM物料编码/Test Part No.">
<el-input v-model="projectMaterialSearchData.testPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="描述/Part Desc">
<el-input v-model="projectMaterialSearchData.partDesc" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="IFS物料编码/Final Part No.">
<el-input v-model="projectMaterialSearchData.finalPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="客户料号/Customer Part No.">
<el-input v-model="projectMaterialSearchData.customerPartNo" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchProjectMaterialList">查询</el-button>
</el-form-item>
</el-form>
<el-table
ref="projectMaterialTable"
class="rohs-material-table"
border
v-loading="projectMaterialLoading"
:data="projectMaterialList"
@selection-change="projectMaterialSelectionChange"
:header-cell-style="materialDialogHeaderCellStyle"
:height="320"
style="width: 100%">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="projectMaterialSizeChangeHandle"
@current-change="projectMaterialCurrentChangeHandle"
:current-page="projectMaterialPageIndex"
:page-sizes="[20, 50, 100]"
:page-size="projectMaterialPageSize"
:total="projectMaterialTotal"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-footer style="height:35px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="confirmProjectMaterialSelection">确定</el-button>
<el-button type="primary" @click="projectMaterialDialogFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
<el-form label-position="top">
<el-form-item label="驳回意见/Reject Opinion">
<el-input type="textarea" v-model="rejectOpinion" :rows="3" resize="none" show-word-limit style="width: 479px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;text-align:center">
<el-button type="primary" :loading="submitLoading" @click="rejectSubmit">确定</el-button>
<el-button type="primary" @click="submitModalFlag = false">取消</el-button>
</el-footer>
</el-dialog>
<!-- 底部附件页签 -->
<el-tabs v-model="activeTable" style="width: 100%; height: 100%;" type="border-card" @tab-click="refreshCurrentTabTable" class="customer-tab">
<el-tab-pane label="基本信息" name="basicInfo">
<div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">申请人/Applicant</span>
<el-input :value="currentRow.applicant || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.applicantName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="申请日期/Application Date">
<el-date-picker :value="currentRow.applicationDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 190px"></el-date-picker>
</el-form-item>
<el-form-item label="工艺/Process">
<el-input :value="currentRow.process || ''" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="供应商代码/Vendor Code">
<el-input :value="currentRow.vendorCode || ''" disabled style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="供应商材料编号/Vendor Material Code" style="margin-left: -10px">
<el-input :value="currentRow.vendorMaterialCode || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="辅材用途/Material Use For">
<el-input :value="currentRow.materialUseFor || ''" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="材料分类/Material Classify">
<el-input :value="currentRow.materialClassify || ''" disabled style="width: 394px"></el-input>
</el-form-item>
<el-form-item label="其他材料分类/Other Material Classify" v-if="currentRow.materialClassify && currentRow.materialClassify.includes('Other其他')">
<el-input :value="currentRow.otherMaterialClassify || ''" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">最终客户/End Customer</span>
<el-input :value="currentRow.endCustomer || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.endCustomerName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item>
<span slot="label">PM人员/PM</span>
<el-input :value="currentRow.pm || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.pmName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">项目编码/Project ID</span>
<el-input :value="currentRow.projectId || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.projectName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="颜色/Color">
<el-input :value="currentRow.color || ''" disabled style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="计划转量产时间/Planned Mass Production">
<el-date-picker :value="currentRow.plannedMassProductionDate" disabled type="datetime" value-format="yyyy-MM-dd HH:mm:ss" style="width: 230px"></el-date-picker>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">商品组1 / Comm Group 1</span>
<el-input :value="currentRow.commGroup1 || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.commGroup1Desc || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="是否需偏差许可/Need Deviation">
<el-input :value="displayYesNo(currentRow.needDeviation)" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">商品组2 / Comm Group 2</span>
<el-input :value="currentRow.commGroup2 || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.commGroup2Desc || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="需创建内部编号/Need Create No.">
<el-input :value="displayYesNo(currentRow.needCreateNumber)" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">商品组3 / Comm Group 3</span>
<el-input :value="currentRow.commGroup3 || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.commGroup3Desc || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="是否Fiber材料/Fiber Material">
<el-input :value="displayYesNo(currentRow.isFiberMaterial)" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">NPD工程师/NPD Engineer</span>
<el-input :value="currentRow.npdEngineer || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.npdEngineerName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item label="WM所需求规格/WM Required Spec">
<el-input :value="currentRow.wmRequiredSpec || ''" disabled style="width: 190px"></el-input>
</el-form-item>
<el-form-item label="材料厚度/Material Thickness">
<el-input :value="currentRow.materialThickness || ''" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="材料有效期/Material Validity Time">
<el-date-picker :value="currentRow.materialValidityTime" disabled type="date" value-format="yyyy-MM-dd" style="width: 190px"></el-date-picker>
</el-form-item>
<el-form-item label="有效期备注/Validity Comments">
<el-input :value="currentRow.materialValidityComments || ''" disabled style="width: 190px"></el-input>
</el-form-item>
<el-form-item label="报告时间(月)/Expect Report Time">
<el-input :value="currentRow.expectReportTime" disabled style="width: 190px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item>
<span slot="label">技术计划/Technical Plan</span>
<el-input :value="currentRow.technicalPlan || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.technicalPlanName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
<el-form-item>
<span slot="label">采购/Buyer</span>
<el-input :value="currentRow.buyer || ''" disabled style="width: 150px"></el-input>
<el-input :value="currentRow.buyerName || ''" disabled style="width: 240px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="所需审批文件/Docs Needed">
<el-input :value="currentRow.qualificationDocumentsNeeded || ''" disabled style="width: 394px"></el-input>
</el-form-item>
<el-form-item label="测试报告必测项/Test Items">
<el-input :value="currentRow.testReportIncludingItems || ''" disabled style="width: 394px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="备注说明/Remark" style="display: block;">
<el-input type="textarea" :rows="3" :value="currentRow.remark || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="HSF 填写信息" name="hsfInfo">
<div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="SGS报告编号/SGS Report Number">
<el-input :value="currentRow.sgsReportNumber || ''" disabled style="width: 230px"></el-input>
</el-form-item>
<el-form-item label="报告日期/Expired Date">
<el-date-picker :value="currentRow.expiredDate" disabled type="date" value-format="yyyy-MM-dd" style="width: 180px"></el-date-picker>
</el-form-item>
<el-form-item label="有效期/Valid Until">
<el-input :value="currentRow.validUntil || ''" disabled style="width: 180px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="是否符合RoHS/Meet RoHS Req"><el-input :value="displayYesNo(currentRow.isMeetRohsRequirement)" disabled style="width: 230px"></el-input></el-form-item>
<el-form-item label="材料属性是否是AH/Is AH Grade"><el-input :value="displayYesNo(currentRow.isAhGrade)" disabled style="width: 180px"></el-input></el-form-item>
<el-form-item label="HSF供应商等级/Supplier Class"><el-input :value="currentRow.hsfSupplierClassification || ''" disabled style="width: 180px"></el-input></el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="Fiber报告信息/Fiber Information" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.fiberInformation || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
</el-form>
<el-form v-if="shouldShowHsfStandard(currentRow.endCustomer)" :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
<el-form-item label="HSF标准/HSF Standard" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.hsfStandard || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="NPD 信息" name="npdInfo">
<div :style="{height: secondHeight + 'px'}" style="margin-left: 5px;margin-top: 5px; overflow-y: auto;">
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="现有材料不同规格/Same Material Diff Size"><el-input :value="displayYesNo(currentRow.isSameMaterialDiffSize)" disabled style="width: 205px"></el-input></el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow">
<el-form-item label="材料描述/Material Desc." style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.materialDesc || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
<el-form-item label="备注说明/NPD Remark" style="display: block;"><el-input type="textarea" :rows="3" :value="currentRow.npdRemark || ''" disabled resize="none" style="width: 802px;height: 30px"></el-input></el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="currentRow" style="margin-top: 50px">
<el-form-item label="TDS属性/TDS Property" style="display: block;">
<oss-components
:save-visible="authFileSave"
:download-visible="authFileDownLoad"
:remove-visible="authFileRemove"
:preview-visible="authFilePreview"
:disabled="true"
label="序列号"
:height="180"
style="margin-top: 2px"
:columns="tdsFileColumnList"
:order-ref1="currentRow.site || ''"
:order-ref2="currentRow.referenceNo || ''"
order-ref3="tdsProperty">
</oss-components>
</el-form-item>
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="材料信息" name="materialInfo">
<div :style="{height: secondHeight + 'px'}" style="overflow-y: auto;">
<el-table
class="rohs-material-table"
border
:data="currentRow.materialList || []"
:height="secondHeight"
style="width: 100%">
<el-table-column type="index" label="序号" width="50" header-align="center" align="center"></el-table-column>
<el-table-column prop="testPartNo" label="PLM物料编码/Test Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="finalPartNo" label="IFS物料编码/Final Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="customerPartNo" label="客户料号/Customer Part No." min-width="180" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="partDesc" label="描述/Part Desc." min-width="220" header-align="center" align="left" :show-overflow-tooltip="true"></el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="附件信息" name="attachment">
<oss-components
:save-visible="authFileSave"
:download-visible="authFileDownLoad"
:remove-visible="authFileRemove"
:preview-visible="authFilePreview"
:disabled="currentRow.status === '已完成'"
label="序列号"
:height="secondHeight - 25"
style="margin-top: 2px"
:columns="fileColumnList"
:order-ref1="currentRow.site"
:order-ref2="currentRow.referenceNo"
order-ref3="rohsAttachment">
</oss-components>
</el-tab-pane>
<el-tab-pane label="审批信息" name="approvalInformation">
<approval-information v-model:data-list="approvalList" :height="secondHeight"></approval-information>
</el-tab-pane>
</el-tabs>
<ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
</div>
</template>
<script>
import * as api from '@/api/rohs/rohs'
import { checkSuperAdmin } from "@/api/changeManagement/changeManagement"
import { verifyData } from "@/api/chooselist/chooselist.js"
import { searchProjectInfoList } from "@/api/quotation/quotationInformation.js"
import { queryCustomer } from "@/api/customer/customerInformation"
import { queryProjectByCustomer } from "@/api/project/project"
import uploadFileList from '../common/uploadFileList'
import ossComponents from '../oss/ossComponents.vue'
import ChooseList from '@/views/modules/common/Chooselist'
import DictDataSelect from "../sys/dict-data-select.vue"
import ApprovalInformation from "../changeManagement/approvalInformation.vue"
export default {
components: {
uploadFileList,
ossComponents,
ChooseList,
DictDataSelect,
ApprovalInformation
},
data () {
return {
searchData: {
site: this.$store.state.user.site,
referenceNo: '',
applicant: ''
},
dataList: [],
pageIndex: 1,
pageSize: 20,
totalPage: 0,
dataListLoading: false,
activeTable: 'basicInfo',
menuId: '108006', // 暂定ROHS菜单ID
authSearch: false,
authUpdate: false,
authIssue: false,
authSubmit: false,
authReject: false,
authFileSave: false,
authFileDownLoad: false,
authFileRemove: false,
authFilePreview: false,
authDelete: false,
superAdmin: false,
createBy2: this.$store.state.user.name,
height: 400,
secondHeight: 200,
currentRow: {},
fileColumnList: [
{
columnProp: 'fileName',
headerAlign: 'center',
align: 'center',
columnLabel: '文件名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 140
},
{
columnProp: 'fileRemark',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 200
},
{
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '上传时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 150
},
{
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '上传人',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 120
}
],
tdsFileColumnList: [
{
columnProp: 'fileNo',
headerAlign: 'center',
align: 'center',
columnLabel: '文件编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 130
},
{
columnProp: 'rev',
headerAlign: 'center',
align: 'center',
columnLabel: '版本号',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 90
},
{
columnProp: 'fileName',
headerAlign: 'center',
align: 'center',
columnLabel: '文件名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 160
},
{
columnProp: 'fileRemark',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 180
},
{
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '上传时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 150
},
{
columnProp: 'invalidationTime',
headerAlign: 'center',
align: 'center',
columnLabel: '失效时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 150
},
{
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '上传人',
columnHidden: false,
columnImage: false,
columnSortable: false,
status: true,
fixed: '',
columnWidth: 120
}
],
modalFlag: false,
uploadDialog: false,
chooseProjectListFlag: false,
projectMaterialDialogFlag: false,
searchProjectData: {
site: '',
projectId: undefined,
projectName: undefined,
customerId: undefined,
},
projectMaterialSearchData: {
testPartNo: '',
partDesc: '',
finalPartNo: '',
customerPartNo: ''
},
projectMaterialList: [],
projectMaterialSelections: [],
materialSelections: [],
projectMaterialPageIndex: 1,
projectMaterialPageSize: 20,
projectMaterialTotal: 0,
projectMaterialLoading: false,
projectList: [],
fileList: [],
approvalList: [],
plmRohsAuthorityArr: [],
nodeAuthorityLoaded: false,
isEditMode: false,
modalTitle: 'RoHs 新增',
activeName: 'basicInfo',
showModalFlag: false,
submitModalFlag: false,
rejectOpinion: '',
submitLoading: false,
modalData: {
site: 'DEFAULT',
referenceNo: '',
applicant: '',
pm: '',
pmName: '',
applicationDate: '',
process: '',
plannedMassProductionDate: '',
color: '',
vendorCode: '',
vendorMaterialCode: '',
materialClassify: '',
otherMaterialClassify: '',
materialUseFor: '',
endCustomer: '',
projectId: '',
commGroup1: '',
commGroup1Desc: '',
commGroup2: '',
commGroup2Desc: '',
commGroup3: '',
commGroup3Desc: '',
needCreateNumber: '',
npdEngineer: '',
materialValidityTime: '',
materialValidityComments: '',
needDeviation: '',
technicalPlan: '',
wmRequiredSpec: '',
isFiberMaterial: '',
materialThickness: '',
buyer: '',
expectReportTime: 0,
qualificationDocumentsNeeded: '',
qualificationDocumentsNeededList: [],
testReportIncludingItems: '',
testReportIncludingItemsList: [],
remark: '',
status: '',
sgsReportNumber: '',
expiredDate: '',
fiberInformation: '',
hsfStandard: '',
validUntil: '',
isMeetRohsRequirement: '',
isAhGrade: '',
hsfSupplierClassification: '',
materialDesc: '',
npdRemark: '',
isSameMaterialDiffSize: '',
ifsPartNo: '',
materialList: [],
stepId: null,
rejectFlag: '',
rejectStepId: null,
createBy2: '',
isReject: 'Y',
tpProcessControl: 'N',
csProcessControl: 'N'
}
}
},
created () {
this.menuId = this.$route.meta.menuId
this.getButtonAuthData()
this.checkSuperAdmin()
},
mounted () {
if (this.authSearch) {
this.getDataList()
}
this.$nextTick(() => {
this.height = window.innerHeight / 2 - 30
/*第二个表格高度的动态调整*/
this.secondHeight = window.innerHeight / 2 - 186
})
},
methods: {
loadNodeAuthority (site, stepId) {
if (!site || stepId === null || stepId === undefined || !this.menuId) {
this.plmRohsAuthorityArr = []
this.nodeAuthorityLoaded = true
return Promise.resolve()
}
this.nodeAuthorityLoaded = false
let params = {
site: site,
stepId: stepId,
menuId: this.menuId
}
return api.getRohsNodeAuthority(params).then(({data}) => {
if (data && data.code === 0 && data.rows) {
this.plmRohsAuthorityArr = data.rows.plm_rohs || []
} else {
this.plmRohsAuthorityArr = []
}
this.nodeAuthorityLoaded = true
}).catch(() => {
this.plmRohsAuthorityArr = []
this.nodeAuthorityLoaded = true
})
},
rohsFieldFlag (fieldId) {
if (!this.plmRohsAuthorityArr || this.plmRohsAuthorityArr.length === 0) {
return 'N'
}
let target = this.plmRohsAuthorityArr.find(item => item.fieldId === fieldId)
return target ? target.updateFlag : 'N'
},
isRohsFieldDisabled (fieldId) {
if (this.showModalFlag) {
return true
}
if (!this.isEditMode) {
return false
}
return this.rohsFieldFlag(fieldId) === 'N'
},
canEditRohsMaterial () {
return !this.showModalFlag
},
getRohsSubmitFieldValue (fieldId) {
const fieldMapping = {
materialClassify: 'materialClassifyList',
qualificationDocumentsNeeded: 'qualificationDocumentsNeededList',
testReportIncludingItems: 'testReportIncludingItemsList'
}
const mappedField = fieldMapping[fieldId]
if (mappedField) {
return this.modalData[mappedField]
}
return this.modalData[fieldId]
},
isSubmitFieldEmpty (value) {
if (Array.isArray(value)) {
return value.length === 0
}
if (typeof value === 'string') {
return value.trim() === ''
}
return !value
},
validateSubmitRequiredFields () {
if (this.plmRohsAuthorityArr && this.plmRohsAuthorityArr.length > 0) {
for (let i = 0; i < this.plmRohsAuthorityArr.length; i++) {
const fieldConfig = this.plmRohsAuthorityArr[i]
if (fieldConfig.required !== 'Y') {
continue
}
if (fieldConfig.fieldId === 'hsfStandard' && !this.shouldShowHsfStandard(this.modalData.endCustomer)) {
continue
}
const value = this.getRohsSubmitFieldValue(fieldConfig.fieldId)
if (this.isSubmitFieldEmpty(value)) {
this.$message.warning((fieldConfig.fieldName || fieldConfig.fieldId) + '不能为空!')
return false
}
}
}
return true
},
materialDialogHeaderCellStyle () {
return {
whiteSpace: 'nowrap',
wordBreak: 'keep-all'
}
},
displayYesNo (value) {
if (value === 'Y') {
return '是'
}
if (value === 'N') {
return '否'
}
return value || ''
},
shouldShowHsfStandard (customerCode) {
return String(customerCode || '').trim().toUpperCase() === 'C00052'
},
normalizeHsfStandardByCustomer (formData) {
if (!formData) {
return
}
if (!this.shouldShowHsfStandard(formData.endCustomer)) {
this.$set(formData, 'hsfStandard', '')
}
},
isCurrentApprover () {
return this.superAdmin || (this.modalData.createBy2 && this.modalData.createBy2.split(';').includes(this.createBy2))
},
canSaveAction () {
return !this.showModalFlag && (this.modalData.status === '草稿' || (this.modalData.status === '审批中' && this.isCurrentApprover()))
},
canAgreeAction () {
return this.authSubmit && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.tpProcessControl !== 'Y' && this.modalData.csProcessControl !== 'Y'
},
canRejectAction () {
return this.authReject && this.isCurrentApprover() && this.modalData.status === '审批中' && this.modalData.isReject === 'Y'
},
loadModalButtonCondition () {
if (!this.modalData.site || !this.modalData.referenceNo || this.modalData.status !== '审批中') {
this.$set(this.modalData, 'createBy2', '')
this.$set(this.modalData, 'isReject', 'Y')
this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N')
return
}
let params = {
site: this.modalData.site,
referenceNo: this.modalData.referenceNo
}
api.getRohsButtonCondition(params).then(({data}) => {
if (data && data.code === 0 && data.data) {
this.$set(this.modalData, 'createBy2', data.data.createBy2 || '')
this.$set(this.modalData, 'isReject', data.data.isReject || 'Y')
this.$set(this.modalData, 'tpProcessControl', data.data.tpProcessControl || 'N')
this.$set(this.modalData, 'csProcessControl', data.data.csProcessControl || 'N')
} else {
this.$set(this.modalData, 'createBy2', '')
this.$set(this.modalData, 'isReject', 'Y')
this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N')
}
}).catch(() => {
this.$set(this.modalData, 'createBy2', '')
this.$set(this.modalData, 'isReject', 'Y')
this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N')
})
},
// 列表行选中变色
rowStyle ({row}) {
if (this.currentRow && this.currentRow.referenceNo === row.referenceNo) {
return { 'background-color': '#E8F7F6', cursor: 'pointer' }
}
},
// 获取按钮的权限数据
getButtonAuthData () {
this.authSearch = this.isAuth(this.menuId+":search")
this.authUpdate = this.isAuth(this.menuId+":update")
this.authIssue = this.isAuth(this.menuId+":issue")
this.authSubmit = this.isAuth(this.menuId+":submit")
this.authReject = this.isAuth(this.menuId+":reject")
this.authFileSave = this.isAuth(this.menuId+":fileSave")
this.authFileDownLoad = this.isAuth(this.menuId+":fileDownLoad")
this.authFileRemove = this.isAuth(this.menuId+":fileRemove")
this.authFilePreview = this.isAuth(this.menuId+":filePreview")
this.authDelete = this.isAuth(this.menuId+":delete")
},
// 校验是否为超级管理员
checkSuperAdmin () {
checkSuperAdmin().then(({data}) => {
this.superAdmin = data.superAdmin
})
},
changeClickRow (row, column, event) {
// 通过接口或直接赋值,让底部的页签显示当前选中行的数据
api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
if (data && data.code === 0) {
this.currentRow = data.data || {}
} else {
this.currentRow = row || {}
}
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.fillDisplayFields(this.currentRow, row || {})
this.refreshCurrentTabTable()
}).catch(() => {
this.currentRow = row || {}
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.fillDisplayFields(this.currentRow)
this.refreshCurrentTabTable()
})
},
currentChange (val) {
this.currentRow = val || {}
if (val) {
if (!Array.isArray(this.currentRow.materialList)) {
this.$set(this.currentRow, 'materialList', [])
}
this.fillDisplayFields(this.currentRow)
this.refreshCurrentTabTable()
} else {
this.approvalList = []
}
},
fillDisplayFields (target, fallbackData = {}) {
if (!target) {
return
}
const fields = ['applicantName', 'pmName', 'npdEngineerName', 'technicalPlanName', 'buyerName', 'endCustomerName', 'projectName', 'commGroup1Desc', 'commGroup2Desc', 'commGroup3Desc']
fields.forEach(field => {
const value = target[field] || fallbackData[field] || ''
this.$set(target, field, value)
})
this.$set(target, 'endCustomerFlag', !!target.endCustomerFlag)
this.$set(target, 'projectIdFlag', !!target.projectIdFlag)
},
refreshCurrentTabTable () {
if (this.activeTable === 'approvalInformation') {
this.getApprovalList()
}
},
getApprovalList () {
if (!this.currentRow || !this.currentRow.site || !this.currentRow.referenceNo) {
this.approvalList = []
return
}
let params = {
site: this.currentRow.site,
menuId: this.menuId,
documentNo: this.currentRow.referenceNo
}
api.getRohsApprovalList(params).then(({data}) => {
if (data && data.code === 0) {
this.approvalList = data.rows || []
} else {
this.approvalList = []
}
}).catch(() => {
this.approvalList = []
})
},
// 获取列表
getDataList () {
if (!this.authSearch) {
this.dataList = []
this.totalPage = 0
this.currentRow = {}
this.approvalList = []
return
}
this.dataListLoading = true
let params = {
page: this.pageIndex,
limit: this.pageSize,
site: this.$store.state.user.site,
menuId: this.menuId,
referenceNo: this.searchData.referenceNo,
applicant: this.searchData.applicant
}
api.getRohsList(params).then(({data}) => {
if (data && data.code === 0) {
const list = data.page.list || []
this.dataList = list.map(item => {
return {
applicantName: '',
pmName: '',
npdEngineerName: '',
technicalPlanName: '',
buyerName: '',
endCustomerName: '',
projectName: '',
nodeId: '',
nodeName: '',
currentApprover: '',
commGroup1Desc: '',
commGroup2Desc: '',
commGroup3Desc: '',
...item
}
})
this.totalPage = data.page.totalCount
this.$nextTick(() => {
if (this.$refs.rohsTable && this.dataList.length > 0) {
this.$refs.rohsTable.setCurrentRow(this.dataList[0])
} else if (this.$refs.rohsTable) {
this.$refs.rohsTable.setCurrentRow()
}
})
} else {
this.dataList = []
this.totalPage = 0
this.currentRow = {}
this.approvalList = []
}
this.dataListLoading = false
}).catch(() => {
this.currentRow = {}
this.approvalList = []
this.dataListLoading = false
})
},
// 分页
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 搜索条件点击
searchHandle () {
if (!this.authSearch) {
return
}
this.pageIndex = 1
this.getDataList()
},
// 单选可取消
radioClick (field, value) {
if (this.modalData[field] === value) {
this.modalData[field] = ''
} else {
this.modalData[field] = value
}
},
// 导出
exportHandle () {
if (!this.authSearch) {
return
}
this.$message.info('导出功能开发中')
},
// 新增 / 修改
addOrUpdateHandle (row) {
if (!row && !this.authUpdate) {
this.$message.warning('没有新增权限')
return
}
if (row && !this.authUpdate) {
this.$message.warning('没有编辑权限')
return
}
this.modalFlag = true
this.activeName = 'basicInfo'
this.fileList = []
this.uploadDialog = false
this.submitModalFlag = false
this.rejectOpinion = ''
this.projectMaterialDialogFlag = false
this.projectMaterialSelections = []
this.materialSelections = []
this.plmRohsAuthorityArr = []
this.nodeAuthorityLoaded = !row
this.isEditMode = !!row
this.projectMaterialPageIndex = 1
this.projectMaterialTotal = 0
this.projectMaterialList = []
this.projectMaterialSearchData = {
testPartNo: '',
partDesc: '',
finalPartNo: '',
customerPartNo: ''
}
this.showModalFlag = !!(row && row.status === '已完成')
if (row) {
this.modalTitle = 'RoHs 编辑'
api.getRohsDetail(row.site, row.referenceNo).then(({data}) => {
if (data && data.code === 0) {
this.modalData = data.data || {}
this.$set(this.modalData, 'qualificationDocumentsNeededList', this.modalData.qualificationDocumentsNeeded ? this.modalData.qualificationDocumentsNeeded.split(';').filter(item => item) : [])
this.$set(this.modalData, 'testReportIncludingItemsList', this.modalData.testReportIncludingItems ? this.modalData.testReportIncludingItems.split(';').filter(item => item) : [])
this.$set(this.modalData, 'materialClassifyList', this.modalData.materialClassify ? this.modalData.materialClassify.split(';').filter(item => item) : [])
this.$set(this.modalData, 'materialList', Array.isArray(this.modalData.materialList) ? this.modalData.materialList : [])
this.fillDisplayFields(this.modalData, row || {})
// 编辑时不允许修改最终客户和项目编码
this.$set(this.modalData, 'endCustomerFlag', true)
this.$set(this.modalData, 'projectIdFlag', true)
this.$set(this.modalData, 'createBy2', '')
this.$set(this.modalData, 'isReject', 'Y')
this.$set(this.modalData, 'tpProcessControl', 'N')
this.$set(this.modalData, 'csProcessControl', 'N')
this.loadModalButtonCondition()
this.loadNodeAuthority(this.modalData.site || row.site, this.modalData.stepId !== null && this.modalData.stepId !== undefined ? this.modalData.stepId : (row.stepId !== null && row.stepId !== undefined ? row.stepId : 10))
}
}).catch(() => {
this.loadNodeAuthority(row.site, row.stepId !== null && row.stepId !== undefined ? row.stepId : 10)
})
} else {
this.modalTitle = 'RoHs 新增'
this.showModalFlag = false
// 生成一个临时ID用于附件上传绑定
const tempReferenceNo = 'TEMP-' + new Date().getTime() + '-' + Math.floor(Math.random() * 1000)
this.modalData = {
site: this.$store.state.user.site,
referenceNo: tempReferenceNo,
applicant: '',
applicantName: '',
pm: '',
pmName: '',
applicationDate: '',
process: '',
plannedMassProductionDate: '',
color: '',
vendorCode: '',
vendorMaterialCode: '',
materialClassify: '',
materialClassifyList: [],
otherMaterialClassify: '',
materialUseFor: '',
endCustomer: '',
endCustomerName: '',
endCustomerFlag: false,
projectId: '',
projectName: '',
projectIdFlag: true,
commGroup1: '',
commGroup1Desc: '',
commGroup2: '',
commGroup2Desc: '',
commGroup3: '',
commGroup3Desc: '',
needCreateNumber: '',
npdEngineer: '',
npdEngineerName: '',
materialValidityTime: '',
materialValidityComments: '',
needDeviation: '',
technicalPlan: '',
wmRequiredSpec: '',
isFiberMaterial: '',
materialThickness: '',
buyer: '',
buyerName: '',
expectReportTime: 0,
qualificationDocumentsNeeded: '',
qualificationDocumentsNeededList: [],
testReportIncludingItems: '',
testReportIncludingItemsList: [],
remark: '',
status: '草稿',
sgsReportNumber: '',
expiredDate: '',
fiberInformation: '',
hsfStandard: '',
validUntil: '',
isMeetRohsRequirement: '',
isAhGrade: '',
hsfSupplierClassification: '',
materialDesc: '',
npdRemark: '',
isSameMaterialDiffSize: '',
ifsPartNo: '',
materialList: [],
stepId: 10,
rejectFlag: 'N',
rejectStepId: null,
createBy2: '',
isReject: 'Y',
tpProcessControl: 'N',
csProcessControl: 'N'
}
this.nodeAuthorityLoaded = true
}
},
// 表单提交
dataFormSubmit () {
if (!this.canSaveAction()) {
this.$message.warning('当前状态不允许保存')
return
}
this.normalizeHsfStandardByCustomer(this.modalData)
this.modalData.qualificationDocumentsNeeded = this.modalData.qualificationDocumentsNeededList.join(';')
this.modalData.testReportIncludingItems = this.modalData.testReportIncludingItemsList.join(';')
this.modalData.materialClassify = this.modalData.materialClassifyList.join(';')
this.modalData.materialList = (this.modalData.materialList || []).map((item, index) => {
return {
...item,
lineNo: index + 1,
projectId: this.modalData.projectId
}
})
const submitMethod = this.modalTitle === 'RoHs 新增' ? api.saveRohs : api.updateRohs
submitMethod(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.modalFlag = false
this.getDataList()
} else {
this.$message.error(data.msg || '操作失败')
}
})
},
// 同意
agreeSubmit () {
if (!this.canAgreeAction()) {
this.$message.warning('当前状态不允许同意')
return
}
this.$confirm('确认同意该申请单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.submitRohs('Y')
})
},
openRejectModal () {
if (!this.canRejectAction()) {
this.$message.warning('当前状态不允许驳回')
return
}
this.rejectOpinion = ''
this.submitModalFlag = true
},
// 驳回
rejectSubmit () {
if (!this.rejectOpinion || !this.rejectOpinion.trim()) {
this.$message.warning('请填写驳回意见')
return
}
this.submitRohs('N')
},
submitRohs (nodeConclusion) {
if (nodeConclusion === 'Y' && !this.canAgreeAction()) {
this.$message.warning('当前状态不允许同意')
return
}
if (nodeConclusion === 'N' && !this.canRejectAction()) {
this.$message.warning('当前状态不允许驳回')
return
}
if (!this.modalData.site || !this.modalData.referenceNo) {
this.$message.warning('单据主键信息缺失,无法提交审批')
return
}
this.normalizeHsfStandardByCustomer(this.modalData)
if (!this.nodeAuthorityLoaded) {
this.$message.warning('节点权限加载中,请稍后重试')
return
}
if (!this.validateSubmitRequiredFields()) {
return
}
const submitMaterialList = this.normalizeMaterialListForSave(this.modalData.materialList || [])
this.submitLoading = true
let params = {
...this.modalData,
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
materialClassify: (this.modalData.materialClassifyList || []).join(';'),
qualificationDocumentsNeeded: (this.modalData.qualificationDocumentsNeededList || []).join(';'),
testReportIncludingItems: (this.modalData.testReportIncludingItemsList || []).join(';'),
materialList: submitMaterialList,
nodeConclusion: nodeConclusion,
rejectOpinion: nodeConclusion === 'N' ? this.rejectOpinion : '',
menuId: this.menuId,
documentNo: this.modalData.referenceNo
}
api.submitRohs(params).then(({data}) => {
if (data && data.code === 0) {
this.$message.success(nodeConclusion === 'Y' ? '同意成功' : '驳回成功')
this.submitModalFlag = false
this.modalFlag = false
this.getDataList()
} else {
this.$message.error(data.msg || '提交失败')
}
this.submitLoading = false
}).catch(() => {
this.submitLoading = false
})
},
// 下达
issueModal (row) {
if (!this.authIssue) {
this.$message.warning('没有下达权限')
return
}
this.$confirm('确认下达该申请单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {
site: row.site,
referenceNo: row.referenceNo,
menuId: this.menuId
}
api.issueRohs(params).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('下达成功')
if (this.modalFlag && this.modalData.referenceNo === row.referenceNo) {
this.modalData.status = '审批中'
}
this.getDataList()
} else {
this.$message.error(data.msg || '下达失败')
}
})
})
},
openProjectMaterialDialog () {
if (!this.canEditRohsMaterial()) {
this.$message.warning('当前状态不允许编辑材料')
return
}
if (!this.modalData.projectId) {
this.$message.warning('请先选择项目编码')
return
}
if (!this.modalData.endCustomer) {
this.$message.warning('请先选择最终客户')
return
}
this.projectMaterialDialogFlag = true
this.projectMaterialPageIndex = 1
this.searchProjectMaterialList()
},
searchProjectMaterialList () {
if (!this.modalData.projectId) {
this.projectMaterialList = []
this.projectMaterialTotal = 0
return
}
this.projectMaterialLoading = true
const params = {
page: this.projectMaterialPageIndex,
limit: this.projectMaterialPageSize,
site: this.$store.state.user.site,
projectId: this.modalData.projectId,
endCustomer: this.modalData.endCustomer,
testPartNo: this.projectMaterialSearchData.testPartNo,
partDesc: this.projectMaterialSearchData.partDesc,
finalPartNo: this.projectMaterialSearchData.finalPartNo,
customerPartNo: this.projectMaterialSearchData.customerPartNo
}
api.getRohsProjectMaterialList(params).then(({data}) => {
if (data && data.code === 0 && data.page) {
this.projectMaterialList = data.page.list || []
this.projectMaterialTotal = data.page.totalCount || 0
this.$nextTick(() => {
if (this.$refs.projectMaterialTable) {
this.$refs.projectMaterialTable.clearSelection()
}
})
} else {
this.projectMaterialList = []
this.projectMaterialTotal = 0
this.$message.error(data.msg || '项目物料查询失败')
}
this.projectMaterialLoading = false
}).catch(() => {
this.projectMaterialList = []
this.projectMaterialTotal = 0
this.projectMaterialLoading = false
})
},
projectMaterialSelectionChange (rows) {
this.projectMaterialSelections = rows || []
},
projectMaterialSizeChangeHandle (val) {
this.projectMaterialPageSize = val
this.projectMaterialPageIndex = 1
this.searchProjectMaterialList()
},
projectMaterialCurrentChangeHandle (val) {
this.projectMaterialPageIndex = val
this.searchProjectMaterialList()
},
confirmProjectMaterialSelection () {
if (!this.canEditRohsMaterial()) {
this.$message.warning('当前状态不允许编辑材料')
return
}
if (!this.projectMaterialSelections || this.projectMaterialSelections.length === 0) {
this.$message.warning('请至少选择一条项目物料')
return
}
const appendResult = this.appendMaterialRows(this.projectMaterialSelections)
if (!appendResult.appendedCount) {
this.$message.warning('所选物料已存在,未新增数据')
return
}
if (!this.shouldPersistMaterialsImmediately()) {
this.$set(this.modalData, 'materialList', appendResult.materialList)
this.projectMaterialDialogFlag = false
this.$message.success('已加入材料列表,保存单据后写入数据库')
return
}
this.$confirm('确认新增选中材料?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.persistMaterialList(appendResult.materialList, '新增材料成功', () => {
this.projectMaterialDialogFlag = false
this.projectMaterialSelections = []
if (this.$refs.projectMaterialTable) {
this.$refs.projectMaterialTable.clearSelection()
}
})
}).catch(() => {})
},
appendMaterialRows (rows) {
const materialList = Array.isArray(this.modalData.materialList) ? [...this.modalData.materialList] : []
const exists = new Set(materialList.map(item => item.testPartNo))
let appendedCount = 0
rows.forEach(row => {
const testPartNo = row.testPartNo || row.test_part_no
if (!testPartNo || exists.has(testPartNo)) {
return
}
exists.add(testPartNo)
appendedCount++
materialList.push({
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
projectId: this.modalData.projectId,
testPartNo: testPartNo,
finalPartNo: row.finalPartNo || row.final_part_no || '',
customerPartNo: row.customerPartNo || row.customer_part_no || '',
partDesc: row.partDesc || row.part_desc || '',
partSpec: row.partSpec || row.part_spec || ''
})
})
return {
materialList,
appendedCount
}
},
materialSelectionChange (rows) {
this.materialSelections = rows || []
},
shouldPersistMaterialsImmediately () {
return this.modalTitle === 'RoHs 编辑' && this.modalData && this.modalData.referenceNo && !String(this.modalData.referenceNo).startsWith('TEMP-')
},
normalizeMaterialListForSave (materialList) {
return (materialList || []).map((item, index) => {
return {
...item,
lineNo: index + 1,
projectId: item.projectId || this.modalData.projectId || ''
}
})
},
persistMaterialList (materialList, successMsg, successCallback) {
const normalizedList = this.normalizeMaterialListForSave(materialList)
const payload = {
site: this.modalData.site,
referenceNo: this.modalData.referenceNo,
projectId: this.modalData.projectId,
materialList: normalizedList
}
api.updateRohsMaterials(payload).then(({data}) => {
if (data && data.code === 0) {
this.$set(this.modalData, 'materialList', normalizedList)
this.materialSelections = []
if (this.currentRow && this.currentRow.referenceNo === this.modalData.referenceNo) {
this.$set(this.currentRow, 'materialList', normalizedList)
}
this.$message.success(successMsg || '保存成功')
if (typeof successCallback === 'function') {
successCallback()
}
} else {
this.$message.error((data && data.msg) || '保存失败')
}
}).catch(() => {
this.$message.error('保存失败')
})
},
removeSelectedMaterialRows () {
if (!this.canEditRohsMaterial()) {
this.$message.warning('当前状态不允许编辑材料')
return
}
if (!this.materialSelections || this.materialSelections.length === 0) {
this.$message.warning('请先选择要删除的材料')
return
}
const removeSet = new Set(this.materialSelections.map(item => item.testPartNo))
const materialList = (this.modalData.materialList || []).filter(item => !removeSet.has(item.testPartNo))
if (!this.shouldPersistMaterialsImmediately()) {
this.$set(this.modalData, 'materialList', materialList)
this.materialSelections = []
this.$message.success('已删除材料,保存单据后写入数据库')
return
}
this.$confirm('确认删除选中材料?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.persistMaterialList(materialList, '删除材料成功')
}).catch(() => {})
},
// ======== chooseList相关方法 ========
// 获取基础数据列表
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (val === 102) {
if (type === 1) {
strVal = this.modalData.endCustomer
}
}
if (val === 103) {
if (type === 1) {
strVal = this.modalData.applicant
} else if (type === 3) {
strVal = this.modalData.npdEngineer
} else if (type === 4) {
strVal = this.modalData.technicalPlan
} else if (type === 5) {
strVal = this.modalData.pm
}
conSql = " and b.site = '" + this.$store.state.user.site + "'"
}
if (val === 2000) {
strVal = this.modalData.buyer
conSql = " and b.site = '" + this.$store.state.user.site + "'"
}
if (val === 110) {
strVal = this.modalData.commGroup1
}
if (val === 111) {
strVal = this.modalData.commGroup2
}
if (val === 130) {
strVal = this.modalData.commGroup3
}
this.$refs.baseList.init(val, strVal, conSql)
})
},
// 列表方法的回调
getBaseData (val) {
if (this.tagNo === 102) {
if (this.tagNo1 === 1) {
if (val.Customer_no === this.modalData.endCustomer) {
return
}
if (this.modalData.projectIdFlag) {
this.modalData.projectIdFlag = false
}
this.modalData.endCustomer = val.Customer_no
this.modalData.endCustomerName = val.Customer_desc
this.modalData.projectId = ''
this.modalData.projectName = ''
this.$set(this.modalData, 'materialList', [])
}
}
if (this.tagNo === 103) {
if (this.tagNo1 === 1) {
this.modalData.applicant = val.username
this.modalData.applicantName = val.user_display
} else if (this.tagNo1 === 3) {
this.modalData.npdEngineer = val.username
this.modalData.npdEngineerName = val.user_display
} else if (this.tagNo1 === 4) {
this.modalData.technicalPlan = val.username
this.modalData.technicalPlanName = val.user_display
} else if (this.tagNo1 === 5) {
this.modalData.pm = val.username
this.modalData.pmName = val.user_display
}
}
if (this.tagNo === 110) {
this.modalData.commGroup1 = val.product_group_id
this.modalData.commGroup1Desc = val.product_group_name
}
if (this.tagNo === 111) {
this.modalData.commGroup2 = val.product_group_id
this.modalData.commGroup2Desc = val.product_group_name
}
if (this.tagNo === 130) {
this.modalData.commGroup3 = val.product_group_id
this.modalData.commGroup3Desc = val.product_group_name
}
if (this.tagNo === 2000) {
this.modalData.buyer = val.username
this.modalData.buyerName = val.user_display
}
},
handleQueryCustomer() {
if (!this.modalData.endCustomer) {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
return
}
let params = {
site: this.$store.state.user.site,
customerNo: this.modalData.endCustomer
}
queryCustomer(params).then(({data}) => {
if (data && data.code === 0) {
if (data.rows && data.rows.length === 1) {
const customer = data.rows[0]
this.modalData.endCustomerName = customer.customerDesc || customer.Customer_desc || customer.customerName || ''
this.modalData.projectIdFlag = !!this.modalData.endCustomerFlag
} else {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
}
} else {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
}
}).catch((error) => {
this.modalData.endCustomerName = ''
this.modalData.projectId = ''
this.modalData.projectName = ''
this.modalData.projectIdFlag = true
this.$set(this.modalData, 'materialList', [])
})
},
handleQueryProjectByCustomer() {
if (!this.modalData.projectId) {
this.modalData.projectName = ''
return
}
let params = {
site: this.$store.state.user.site,
projectId: this.modalData.projectId
}
if (this.modalData.endCustomer) {
params.customerId = this.modalData.endCustomer
}
queryProjectByCustomer(params).then(({data}) => {
if (data && data.code === 0) {
if (data.rows && data.rows.length === 1) {
const project = data.rows[0]
this.modalData.projectName = project.projectName || project.Project_name || ''
} else {
this.modalData.projectName = ''
}
} else {
this.modalData.projectName = ''
}
}).catch((error) => {
this.modalData.projectName = ''
})
},
projectClickRow(row) {
const oldProjectId = this.modalData.projectId
this.modalData.projectId = row.projectId
this.modalData.projectName = row.projectName
if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
// do nothing
} else {
this.modalData.endCustomer = row.customerId
this.modalData.endCustomerName = row.customerName
}
if (oldProjectId && oldProjectId !== row.projectId) {
this.$set(this.modalData, 'materialList', [])
}
this.chooseProjectListFlag = false
},
searchProjectInfoList() {
this.projectList = [];
if (this.modalData.endCustomer && this.modalData.endCustomer !== '') {
this.searchProjectData.customerId = this.modalData.endCustomer
} else {
this.searchProjectData.customerId = undefined
}
this.searchProjectData.site = this.$store.state.user.site
searchProjectInfoList(this.searchProjectData).then(({data}) => {
if (data && data.code === 0) {
const rows = data.rows || []
this.projectList = rows
if ((!this.modalData.endCustomer || this.modalData.endCustomer === '') && rows.length > 0) {
this.modalData.projectId = rows[0].projectId
this.modalData.projectName = rows[0].projectName
this.modalData.endCustomer = rows[0].customerId
this.modalData.endCustomerName = rows[0].customerName
}
} else {
this.projectList = []
}
}).catch((error) => {
this.$message.error('查询项目信息失败')
})
},
closeProjectInfoDialog() {
if(this.$refs.closeProjectInfoForm) {
this.$refs.closeProjectInfoForm.resetFields();
}
this.searchProjectData = {
site: this.$store.state.user.site,
projectId: undefined,
projectName: undefined,
customerId: undefined,
}
},
// 申请人输入校验
applicantBlur (tagNo) {
if (this.modalData.applicant != null && this.modalData.applicant !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and a.username = '" + this.modalData.applicant + "'" + " and b.site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.applicant = data.baseListData[0].username
this.modalData.applicantName = data.baseListData[0].user_display
return
}
}
this.modalData.applicantName = ''
})
} else {
this.modalData.applicantName = ''
}
},
// PM输入校验
pmBlur (tagNo) {
if (this.modalData.pm != null && this.modalData.pm !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and a.username = '" + this.modalData.pm + "'" + " and b.site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.pm = data.baseListData[0].username
this.modalData.pmName = data.baseListData[0].user_display
return
}
}
this.modalData.pmName = ''
})
} else {
this.modalData.pmName = ''
}
},
// NPD工程师输入校验
npdEngineerBlur (tagNo) {
if (this.modalData.npdEngineer != null && this.modalData.npdEngineer !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and a.username = '" + this.modalData.npdEngineer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.npdEngineer = data.baseListData[0].username
this.modalData.npdEngineerName = data.baseListData[0].user_display
return
}
}
this.modalData.npdEngineerName = ''
})
} else {
this.modalData.npdEngineerName = ''
}
},
// 技术计划输入校验
technicalPlanBlur (tagNo) {
if (this.modalData.technicalPlan != null && this.modalData.technicalPlan !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and a.username = '" + this.modalData.technicalPlan + "'" + " and b.site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.technicalPlan = data.baseListData[0].username
this.modalData.technicalPlanName = data.baseListData[0].user_display
return
}
}
this.modalData.technicalPlanName = ''
})
} else {
this.modalData.technicalPlanName = ''
}
},
// 采购输入校验
buyerBlur (tagNo) {
if (this.modalData.buyer != null && this.modalData.buyer !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and a.username = '" + this.modalData.buyer + "'" + " and b.site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.buyer = data.baseListData[0].username
this.modalData.buyerName = data.baseListData[0].user_display
return
}
}
this.modalData.buyerName = ''
})
} else {
this.modalData.buyerName = ''
}
},
// 商品组1输入校验
commGroup1Blur (tagNo) {
if (this.modalData.commGroup1 != null && this.modalData.commGroup1 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.commGroup1 + "'" + " and site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0 && data.baseListData.length > 0) {
this.modalData.commGroup1 = data.baseListData[0].product_group_id
this.modalData.commGroup1Desc = data.baseListData[0].product_group_name
} else {
this.modalData.commGroup1Desc = ''
}
})
} else {
this.modalData.commGroup1Desc = ''
}
},
// 商品组2输入校验
commGroup2Blur (tagNo) {
if (this.modalData.commGroup2 != null && this.modalData.commGroup2 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.commGroup2 + "'" + " and site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0 && data.baseListData.length > 0) {
this.modalData.commGroup2 = data.baseListData[0].product_group_id
this.modalData.commGroup2Desc = data.baseListData[0].product_group_name
} else {
this.modalData.commGroup2Desc = ''
}
})
} else {
this.modalData.commGroup2Desc = ''
}
},
// 商品组3输入校验
commGroup3Blur (tagNo) {
if (this.modalData.commGroup3 != null && this.modalData.commGroup3 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.commGroup3 + "'" + " and site = '" + this.$store.state.user.site + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0 && data.baseListData.length > 0) {
this.modalData.commGroup3 = data.baseListData[0].product_group_id
this.modalData.commGroup3Desc = data.baseListData[0].product_group_name
} else {
this.modalData.commGroup3Desc = ''
}
})
} else {
this.modalData.commGroup3Desc = ''
}
}
}
}
</script>
<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
padding: 0 !important;
}
/deep/ .rohs-material-table .el-table__header-wrapper th > .cell {
white-space: nowrap;
word-break: keep-all;
}
</style>