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.
 
 
 
 
 

3131 lines
112 KiB

<template>
<div class="mod-config">
<!-- 条件查询 -->
<el-form :inline="true" label-position="top" :model="searchData">
<!-- <el-form-item :label="'BU'">
<el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buDesc">
</el-option>
</el-select>
</el-form-item> -->
<el-form-item :label="'产品编码'">
<el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'Item'">
<el-input v-model="searchData.item" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'SKU'">
<el-input v-model="searchData.sku" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="searchData.partDesc" clearable style="width: 200px"></el-input>
</el-form-item>
<!-- <el-form-item :label="'PN'">
<el-input v-model="searchData.cinvSourceCode" clearable style="width: 120px"></el-input>
</el-form-item> -->
<el-form-item :label="'类别名称'">
<el-input v-model="searchData.familyName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
<el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
</el-form-item>
<el-form-item :label="' '">
<!-- <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>-->
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
</el-form-item>
</el-form>
<!-- 展示列表 -->
<el-table
:height="height"
:data="dataList"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed === ''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">
<span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span>
<span v-else>
{{ scope.row[item.columnProp] }}
</span>
</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="280"
label="操作">
<template slot-scope="scope">
<a v-if="!authDetail" type="text" size="small" style="margin-right: 8px" @click="detailModal(scope.row)">检验模板</a>
<a v-if="!authDetail" type="text" size="small" style="margin-right: 8px" @click="openTemplateCopyDialog(scope.row)">复制</a>
<a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
<a v-if="!authDelete" type="text" size="small" @click="deletePropertiesModel(scope.row)">删除</a>
<!-- <a type="text" size="small" @click="sopFileList(scope.row)">SOP文件</a>-->
<a type="text" size="small" @click="openPartSopFileList(scope.row)">物料SOP</a>
</template>
</el-table-column>
</el-table>
<!-- 分页栏 -->
<el-pagination
@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="物料属性设置" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<!-- <el-form-item label="BU" prop="bu" :rules="rules.bu">
<el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 295px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.sitename"
:value = "i.buNo">
<span style="float: left;width: 100px">{{ i.sitename }}</span>
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
{{ i.buDesc }}
</span>
</el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item style="margin-top: 23px;margin-left: 2px">-->
<!-- <el-checkbox v-model="modalData.exemptInspection" true-label="Y">是否免检</el-checkbox><br>-->
<!-- </el-form-item>-->
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<el-form-item prop="partNo" :rules="rules.partNoType">
<span v-if="modalDisableFlag === false" slot="label" @click="searchPartInfo()"><a herf="#">产品编码:</a></span>
<span v-if="modalDisableFlag === true" slot="label">产品编码:</span>
<el-input
v-model="modalData.partNo"
:disabled="modalDisableFlag"
style="width: 120px"
@blur="handleModalPartNoBlur"></el-input>
</el-form-item>
<el-form-item label="Item:">
<el-input v-model="modalData.item" disabled style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="SKU:">
<el-input v-model="modalData.sku" disabled style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="物料名称:" prop="partDesc" :rules="rules.partDescType">
<el-input v-model="modalData.partDesc" disabled style="width: 250px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="备注:">
<el-input v-model="modalData.attributeRemark" style="width: 385px"></el-input>
</el-form-item>
<!-- <el-form-item label="是否免检">-->
<!-- <input type="checkbox" value="Y" name="isExemptInspection" v-model="modalData.exemptInspection"/>-->
<!-- </el-form-item>-->
</el-form>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="saveData()">保存</el-button>
<el-button type="primary" @click="modalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 检验模板 -->
<el-dialog title="检验模板清单" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1400px">
<el-form :inline="true" label-position="top">
<el-form-item :label="'产品编码'">
<el-input v-model="detailData.partNo" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'Item'">
<el-input v-model="detailData.item" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'SKU'">
<el-input v-model="detailData.sku" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="detailData.partDesc" readonly style="width: 300px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="addFastModal()">新增</el-button>
</el-form-item>
</el-form>
<!-- 检验项目展示列表 -->
<div class="rq ">
<el-table
:height="300"
:data="detailList"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnDetailList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="center"
min-width="170"
label="检验水平">
<template slot-scope="scope">
<el-button type="primary" @click="chooseLevel(scope.row)" style="width:18%;padding: 3px 7px">·&nbsp;·&nbsp;·</el-button>
<el-input v-model="scope.row.samplingLevelDesc" readonly style="width:77%"></el-input>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="center"
min-width="60"
label="检验周期(h)">
<template slot-scope="scope">
<el-input v-model="scope.row.inspectionCycle" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="center"
min-width="170"
label="抽样方案">
<template slot-scope="scope">
<el-button type="primary" @click="chooseProgrammeRow(scope.row)" style="width:18%;padding: 3px 7px" >·&nbsp;·&nbsp;·</el-button>
<el-input v-model="scope.row.samplingProgrammeDesc" readonly style="width:77%"></el-input>
</template>
</el-table-column>
<!-- <el-table-column
prop=""
header-align="center"
align="center"
min-width="60"
label="AQL">
<template slot-scope="scope">
<el-input v-model="scope.row.aql" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="center"
min-width="60"
label="AC">
<template slot-scope="scope">
<el-input v-model="scope.row.ac" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
</template>
</el-table-column>
<el-table-column
prop=""
header-align="center"
align="center"
min-width="60"
label="RE">
<template slot-scope="scope">
<el-input v-model="scope.row.re" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
</template>
</el-table-column> -->
<el-table-column
prop="templateRemark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" style="margin-right: 8px" @click="inspectionStandardListModal(scope.row)">检验标准</a>
<a type="text" size="small" @click="deletePartAttributeDetails(scope.row)">删除模板</a>
</template>
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="saveDetail()">保存</el-button>
<el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 检验模板复制:按源物料把“模板清单+检验标准”复制到多个目标物料 -->
<el-dialog
title="复制检验模板"
:visible.sync="templateCopyDialogVisible"
:close-on-click-modal="false"
width="1280px"
v-drag
@close="handleTemplateCopyDialogClose">
<el-form :inline="true" label-position="top">
<el-form-item label="源物料编码">
<el-input v-model="templateCopySource.partNo" disabled style="width: 140px" />
</el-form-item>
<el-form-item label="Item">
<el-input v-model="templateCopySource.item" disabled style="width: 120px" />
</el-form-item>
<el-form-item label="SKU">
<el-input v-model="templateCopySource.sku" disabled style="width: 120px" />
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="templateCopySource.partDesc" disabled style="width: 260px" />
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="templateCopySearch">
<el-form-item label="基准料号">
<el-input v-model="templateCopySearch.basePartNo" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="templateCopySearch.partDesc" clearable style="width: 180px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="SKU">
<el-input v-model="templateCopySearch.sku" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="Item">
<el-input v-model="templateCopySearch.item" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="物料分类1">
<el-input v-model="templateCopySearch.categoryName" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="物料分类2">
<el-input v-model="templateCopySearch.categoryLevel2Name" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="物料分类3">
<el-input v-model="templateCopySearch.categoryLevel3Name" clearable style="width: 130px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label="产品编码">
<el-input v-model="templateCopySearch.partNo" clearable style="width: 140px" @keyup.enter.native="queryTemplateCopyTargetPartList" />
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="queryTemplateCopyTargetPartList">查询</el-button>
</el-form-item>
<el-form-item label=" ">
<el-button @click="resetTemplateCopySearch">重置</el-button>
</el-form-item>
</el-form>
<el-table
ref="templateCopyTable"
:data="templateCopyRows"
:height="360"
border
v-loading="templateCopyDialogLoading"
@selection-change="handleTemplateCopySelectionChange"
style="width: 100%">
<el-table-column
type="selection"
width="50"
header-align="center"
align="center"
:selectable="templateCopyRowSelectable" />
<el-table-column prop="partNo" label="产品编码" min-width="160" header-align="center" align="left" />
<el-table-column prop="partDesc" label="物料名称" min-width="220" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="item" label="Item" min-width="120" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="sku" label="SKU" min-width="120" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="basePartNo" label="基准料号" min-width="140" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="categoryName" label="物料分类1" min-width="130" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="categoryLevel2Name" label="物料分类2" min-width="130" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="categoryLevel3Name" label="物料分类3" min-width="130" header-align="center" align="left" show-overflow-tooltip />
</el-table>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" :loading="templateCopySubmitting" @click="submitTemplateCopy">确认复制</el-button>
<el-button :disabled="templateCopySubmitting" @click="templateCopyDialogVisible = false">取消</el-button>
</el-footer>
</el-dialog>
<!-- 物料模板检验标准 -->
<el-dialog title="检验标准清单" :close-on-click-modal="false" v-drag :visible.sync="inspectionStandardListFlag" width="1200px">
<el-form :inline="true" label-position="top">
<el-form-item label="产品编码">
<el-input v-model="standardHeader.attributeNo" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="standardHeader.partDesc" readonly style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="模板编码">
<el-input v-model="standardHeader.templateId" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="检验类型">
<el-input v-model="standardHeader.inspectionTypeName" readonly style="width: 120px"></el-input>
</el-form-item>
</el-form>
<el-table :height="360" :data="standardList" border style="width: 100%;">
<el-table-column prop="itemNo" header-align="center" align="center" width="130" label="检验项目编码"></el-table-column>
<el-table-column prop="itemDesc" header-align="center" align="left" min-width="260" label="检验项目名称"></el-table-column>
<el-table-column prop="valueType" header-align="center" align="center" width="110" label="检测值类型"></el-table-column>
<el-table-column prop="" header-align="center" align="right" width="140" label="标准值">
<template slot-scope="scope"><el-input v-model="scope.row.defaultValue" style="width: 100%"></el-input></template>
</el-table-column>
<el-table-column prop="" header-align="center" align="right" width="120" label="最大值">
<template slot-scope="scope"><el-input v-model="scope.row.maxValue" style="width: 100%"></el-input></template>
</el-table-column>
<el-table-column prop="" header-align="center" align="right" width="120" label="最小值">
<template slot-scope="scope"><el-input v-model="scope.row.minValue" style="width: 100%"></el-input></template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="saveStandardList()">保存</el-button>
<el-button type="primary" @click="inspectionStandardListFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 检验模板->快速新增(append-to-body 避免嵌套弹窗关闭后父弹窗表格不刷新/空白) -->
<el-dialog title="新增" append-to-body @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1100px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="detailData">
<el-form-item :label="'模板编码'">
<el-input v-model="detailData.templateId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'模板名称'">
<el-input v-model="detailData.templateName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="检验类型">
<el-select v-model="detailData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" @change="checkInspectionType()" placeholder="请选择">
<el-option
v-for = "i in options"
:key = "i.inspectionTypeNo"
:label = "i.inspectionTypeName"
:value = "i.inspectionTypeNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="checkInspectionType()">查询</el-button>
</el-form-item>
<el-form-item style="margin-left: 117px" :label="' '">
<el-button type="primary" @click="getOperationList()" style="width: 63px" v-if="this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107' || this.detailData.inspectionTypeNo === '108'">工序</el-button>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getAllResourceList()" style="width: 63px" v-if="this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107'">机台</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 470px;padding: 1px">
<span style="font-size: 12px" >可选模板:</span>
<el-table
height="400px"
:data="itemList1"
border
ref="itemTable1"
@row-click="itemClickRow1"
@selection-change="selectionItem1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="selectFlag"
width="50">
</el-table-column>
<el-table-column
prop="templateId"
header-align="center"
align="center"
min-width="80"
label="模板编码">
</el-table-column>
<el-table-column
prop="templateName"
header-align="center"
align="center"
min-width="170"
label="模板名称">
</el-table-column>
<el-table-column
prop="inspectionTypeName"
header-align="center"
align="center"
min-width="80"
label="检验类型">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 100px;padding: 1px">
<div style="margin-top: 180px;margin-left: 18px">
<el-button type="primary" @click="addItem()">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteItem()">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 470px;padding: 1px">
<span style="font-size: 12px">已有模板:</span>
<el-table
height="400px"
:data="itemList2"
border
ref="itemTable2"
@row-click="itemClickRow2"
@selection-change="selectionItem2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="selectFlag"
width="50">
</el-table-column>
<el-table-column
prop="templateId"
header-align="center"
align="center"
label="模板编码">
</el-table-column>
<el-table-column
prop="templateName"
header-align="center"
align="center"
label="模板名称">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="operation"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- label="工序">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="resourceID"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- label="机台">-->
<!-- </el-table-column>-->
<el-table-column
prop="inspectionTypeName"
header-align="center"
align="center"
label="检验类型">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 工序 -->
<el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="420px">
<div class="rq">
<el-form :inline="true" label-position="top" :model="operationData">
<el-form-item :label="'工序:'">
<el-input v-model="operationData.operationDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getOperationList2()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="operationList"
ref="operationTable"
@row-click="operationClickRow"
@selection-change="selectionOperationChangeHandle"
border
:row-class-name="operationRowClassName"
style="width: 100%;">
<el-table-column type="index" width="50" align="center">
<template slot-scope="scope">
<el-radio v-model="operationCurrent" :label="scope.row.index">{{''}}</el-radio>
</template>
</el-table-column>
<el-table-column
prop="operationDesc"
header-align="center"
align="center"
label="工序">
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="confirmOperation()">确认</el-button>
</el-footer>
</el-dialog>
<!-- 机台 -->
<el-dialog title="机台清单" :close-on-click-modal="false" v-drag :visible.sync="resourceModelFlag" width="420px">
<div class="rq">
<el-form :inline="true" label-position="top" :model="resourceData">
<el-form-item :label="'机台编码'">
<el-input v-model="resourceData.resourceId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'机台名称'">
<el-input v-model="resourceData.resourceDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getAllResourceList2()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="resourceList"
ref="resourceTable"
@row-click="resourceClickRow"
@selection-change="selectionResourceChangeHandle"
border
:row-class-name="resourceRowClassName"
style="width: 100%;">
<el-table-column type="index" width="50" align="center">
<template slot-scope="scope">
<el-radio v-model="resourceCurrent" :label="scope.row.index">{{''}}</el-radio>
</template>
</el-table-column>
<el-table-column
prop="resourceId"
header-align="center"
align="center"
label="机台编码">
</el-table-column>
<el-table-column
prop="resourceDesc"
header-align="center"
align="center"
label="机台名称">
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="confirmResource()">确认</el-button>
</el-footer>
</el-dialog>
<!-- 供应商 -->
<el-dialog title="供应商清单" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="520px">
<div class="rq">
<el-form :inline="true" label-position="top" :model="manufacturerData">
<el-form-item :label="'供应商编码:'">
<el-input v-model="manufacturerData.manufacturerID" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'供应商名称:'">
<el-input v-model="manufacturerData.manufacturerName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getManufacturerList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="manufacturerList"
ref="manufacturerTable"
@row-click="manufacturerClickRow"
@selection-change="selectionManufacturerChangeHandle"
border
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="selectFlag"
width="50">
</el-table-column>
<el-table-column
prop="manufacturerID"
header-align="center"
align="center"
label="供应商编码">
</el-table-column>
<el-table-column
prop="manufacturerName"
header-align="center"
align="center"
label="供应商名称">
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="confirmManufacturer()">确认</el-button>
<el-button type="primary" @click="manufacturerModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- sop文件清单 -->
<el-dialog title="SOP文件清单" :close-on-click-modal="false" v-drag :visible.sync="sopFileModelFlag" width="800px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item :label="' '">
<el-button type="primary" @click="uploadSopFile">上传文件</el-button>
</el-form-item>
<el-form-item label="检验类型" style="margin-left: 448px">
<el-select v-model="sopData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择">
<el-option v-if="!lineInspectionRoleFlag" label="全部" value=""></el-option>
<el-option
v-for = "i in options"
:key = "i.inspectionTypeNo"
:label = "i.inspectionTypeName"
:value = "i.inspectionTypeNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getFileContentList">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="350"
:data="sopList"
border
style="width: 100%; ">
<el-table-column
v-for="(item,index) in sopColumnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="100"
label="操作">
<template slot-scope="scope">
<a @click="downloadFile(scope.row)">下载</a>
<a type="text" size="small" @click="deleteFile(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="物料SOP文件清单" :close-on-click-modal="false" v-drag :visible.sync="partSopFileModelFlag" width="860px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item :label="' '">
<el-button type="primary" @click="openPartSopUploadDialog">上传文件</el-button>
</el-form-item>
</el-form>
<el-table
:height="350"
:data="partSopList"
border
v-loading="partSopLoading"
style="width: 100%;">
<el-table-column prop="fileName" label="文件名称" min-width="260" show-overflow-tooltip />
<el-table-column prop="createdBy" label="上传人" width="120" align="center" />
<el-table-column prop="createDate" label="上传时间" width="180" align="center" />
<el-table-column prop="cadditionalInfo" label="备注" min-width="180" show-overflow-tooltip />
<el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
<template slot-scope="scope">
<a @click="previewPartSopFile(scope.row)">查看 |</a>
<a type="text" size="small" @click="removePartSopFile(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="上传" :visible.sync="ossVisible" v-drag width="400px" append-to-body :close-on-click-modal="false">
<el-form ref="form" class="rq" label-width="80px" label-position="top">
<el-row :gutter="10">
<slot></slot>
<el-col :span="24">
<el-form-item label=" " class="auto">
<el-upload drag :file-list="fileList2"
action="#" ref="upload"
:on-remove="onRemoveFile"
:on-change="onChangeFile"
multiple
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="备注" class="auto" >
<el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="uploadLoading" @click="handleUploadFiles">确认</el-button>
<el-button @click="ossVisible = false">取消</el-button>
</span>
</el-dialog>
<!-- 产品编码 -->
<el-dialog title="物料选择" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="partDisableFlag" width="685px" height="273px">
<el-form :inline="true" label-position="top" :model="partDetailData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="产品编码">
<el-input v-model="partDetailData.partNo" clearable style="width: 137px"></el-input>
</el-form-item>
<el-form-item label="Item">
<el-input v-model="partDetailData.item" clearable style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="SKU">
<el-input v-model="partDetailData.sku" clearable style="width: 100px"></el-input>
</el-form-item>
<el-form-item label="物料名称">
<el-input v-model="partDetailData.partDesc" clearable style="width: 137px"></el-input>
</el-form-item>
<!-- <el-form-item label="PN">-->
<!-- <el-input v-model="partDetailData.cinvSourceCode" clearable style="width: 100px"></el-input>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" @click="searchPartInfo()" style="margin-top: 24px">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="400"
:data="partInfoList"
@row-dblclick="getRowData1"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
prop="partNo"
header-align="center"
align="center"
label="产品编码">
</el-table-column>
<el-table-column
prop="item"
header-align="center"
align="center"
label="Item">
</el-table-column>
<el-table-column
prop="partDesc"
header-align="center"
align="center"
label="物料名称">
</el-table-column>
<el-table-column
prop="sku"
header-align="center"
align="center"
label="SKU">
</el-table-column>
<!-- <el-table-column-->
<!-- prop="cinvSourceCode"-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- label="PN">-->
<!-- </el-table-column>-->
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="partDisableFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<!-- 上传sop文件的modal -->
<qcSOPUploadFile ref="qcSOPUploadFile" @refreshPageTables="getFileContentList()" v-drag></qcSOPUploadFile>
<!-- 导入 -->
<qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
</div>
</template>
<script>
import {
qcPartAttributeSearch, // 查询物料属性
qcPartAttributeSave, // 新增物料属性
qcPartAttributeDelete, // 删除物料属性
qcPartAttributeEdit, // 修改物料属性
searchPartAttributeDetails, // 查询物料属性模板
savePartAttributeDetails, // 新增物料属性模板
deletePartAttributeDetails, // 删除物料属性模板
saveAttributeDetailed, // 新增物料属性模板详情
getPartTemplateLists, // 获取模板列表
qcAttributeTemplateItemDetailsSearch, // 查询物料模板检验标准明细
qcAttributeTemplateItemSave, // 保存物料模板检验标准明细
inspectionTypeSearch, // 搜索所有检验类型
getOperationDescList, // 查询工序列表
getManufacturerList, // 查询供应商列表
getAllResourceList, // 查询机台列表
getSiteAndBuByUserName,
searchPartInfo, // 查询物料信息
listPartAttributeTemplateCopyTargetParts, // 查询模板复制候选物料
checkPartAttributeTemplateCopyConflicts, // 校验复制冲突(目标物料是否已有模板)
copyPartAttributeTemplateToParts, // 执行模板主从复制(支持覆盖)
} from "@/api/qc/qc.js"
import { buildQcBu } from './qcBuUtils'
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
import {deleteObjectFile} from '@/api/eam/eam.js'
import {queryOssFilePlus, ossUploadNoSaveOSSForYJY, previewOssFileById, removeOss} from '@/api/oss/oss'
import qcUpload from "./qc_upload"
import qcSOPUploadFile from "./qc_SOP_upload_file"
export default {
components: {
qcSOPUploadFile,
Chooselist,
qcUpload
},
data () {
return {
columnsProp:['createBy', 'updateBy'],
// 是否收藏
favorite: false,
// 导出 start
exportData: [],
exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ["根据物料设置检验模板"],
exportFooter: [],
exportList: [],
// 导出 end
tagNo: '',
searchData: {
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
partNo: '',
item: '',
partDesc: '',
cinvSourceCode: '',
sku: '',
familyID: '',
familyName: '',
buDesc: '',
attributeType: 'A',
page: 1,
limit: 10,
},
height: 200,
pageIndex: 1,
pageSize: 20,
totalPage: 0,
modalFlag: false,
modalDisableFlag: false,
partDisableFlag: false,
modalData: {
site: '',
bu: '',
flag: '',
partNo: '',
item: '',
partDesc: '',
familyID: '',
familyName: '',
cinvSourceCode: '',
sku: '',
umid: '',
supplierNo: '',
supplierDesc: '',
attributeRemark: '',
createTime: '',
createBy: this.$store.state.user.name,
attributeType: 'A',
exemptInspection: ''
},
detailData: {
site: '',
buNo: '',
partNo: '',
attributeNo: '',
item: '',
partDesc: '',
cinvSourceCode: '',
sku: '',
attributeType: 'A',
inspectionTypeNo: '',
templateId: '',
templateName: '',
createBy: this.$store.state.user.name
},
columnList: [
// {
// userId: this.$store.state.user.name,
// functionId: 301003,
// serialNumber: '301003Table1BuDesc',
// tableId: "301003Table1",
// tableName: "物料属性设置表",
// columnProp: 'buDesc',
// headerAlign: "center",
// align: "center",
// columnLabel: 'BU',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100,
// },
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1PartNo',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'partNo',
headerAlign: "center",
align: "center",
columnLabel: '产品编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1Item',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'item',
headerAlign: "center",
align: "center",
columnLabel: 'Item',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1SKU',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'sku',
headerAlign: "center",
align: "center",
columnLabel: 'SKU',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1PartDesc',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'partDesc',
headerAlign: "center",
align: "left",
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300,
},
// {
// userId: this.$store.state.user.name,
// functionId: 301003,
// serialNumber: '301003Table1CinvSourceCode',
// tableId: "301003Table1",
// tableName: "物料属性设置表",
// columnProp: 'cinvSourceCode',
// headerAlign: "center",
// align: "center",
// columnLabel: 'PN',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 120,
// },
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1FamilyName',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'familyName',
headerAlign: "center",
align: "left",
columnLabel: '物料类别',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1Spec',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'spec',
headerAlign: "center",
align: "left",
columnLabel: '规格型号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1Umid',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'umid',
headerAlign: "center",
align: "left",
columnLabel: '单位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1ExemptInspection',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'exemptInspection',
headerAlign: "center",
align: "center",
columnLabel: '是否免检',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1AttributeRemark',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'attributeRemark',
headerAlign: "center",
align: "left",
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 200,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1CreateTime',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'createTime',
headerAlign: "center",
align: "center",
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 170,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1CreateBy',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'createBy',
headerAlign: "center",
align: "center",
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1UpdateDate',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'updateDate',
headerAlign: "center",
align: "center",
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 170,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table1UpdateBy',
tableId: "301003Table1",
tableName: "物料属性设置表",
columnProp: 'updateBy',
headerAlign: "center",
align: "center",
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
],
detailModelFlag: false,
detailList: [],
/**
* 模板复制弹窗状态:
* - templateCopySource:当前被复制的源物料(来自主表操作列“复制”);
* - templateCopySearch:目标物料筛选条件(不按供应商,仅筛在用物料);
* - templateCopyRows:目标候选列表;
* - templateCopySelections:用户勾选的目标物料集合。
*/
templateCopyDialogVisible: false,
templateCopyDialogLoading: false,
templateCopySubmitting: false,
templateCopySource: {
site: '',
buNo: '',
partNo: '',
partDesc: '',
item: '',
sku: ''
},
templateCopySearch: {
basePartNo: '',
partNo: '',
partDesc: '',
item: '',
sku: '',
categoryName: '',
categoryLevel2Name: '',
categoryLevel3Name: ''
},
templateCopyRows: [],
templateCopySelections: [],
dataList: [],
dataListLoading: false,
// 展示列集
columnDetailList: [
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2TemplateId',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'templateId',
headerAlign: "center",
align: "center",
columnLabel: '模板编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2TemplateName',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'templateName',
headerAlign: "center",
align: "left",
columnLabel: '模板名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 250,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2InspectionTypeName',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'inspectionTypeName',
headerAlign: "center",
align: "center",
columnLabel: '检验类型',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2TemplateVersion',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'templateVersion',
headerAlign: "center",
align: "center",
columnLabel: '版本号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2DefaultSamplingQuantity',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'defaultSamplingQuantity',
headerAlign: "center",
align: "right",
columnLabel: '默认抽样数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2DefaultSamplingProportion',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'defaultSamplingProportion',
headerAlign: "center",
align: "right",
columnLabel: '默认抽样比例',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100,
},
/* {
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2Operation',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'operation',
headerAlign: "center",
align: "left",
columnLabel: '工序',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 301003,
serialNumber: '301003Table2ResourceID',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'resourceID',
headerAlign: "center",
align: "left",
columnLabel: '机台',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120,
}, */
],
// 快速添加
fastAddFlag: false,
itemList1: [],
itemList2: [],
itemListRow1: {},
itemListRow2: {},
tempLevelRow: '',
tempProgrammeRow: '',
options: [],
itemSelections1: [],
itemSelections2: [],
rules: {
partNoType:[
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
partDescType:[
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
bu: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
]
},
// 工序
operationList: [],
resourceList: [],
operationModelFlag: false,
resourceModelFlag: false,
dataListOperationSelections: [],
operationData: {
operationDesc: ''
},
resourceData: {
site: '',
resourceId: '',
resourceDesc: ''
},
operation: '',
resourceId: '',
selectionManufacturer: [],
// 供应商
manufacturerList: [],
manufacturerModelFlag: false,
dataListManufacturerSelections: [],
manufacturerData: {
site: '',
manufacturerID: '',
manufacturerName: ''
},
// 单选框绑定的值
operationCurrent: -1,
resourceCurrent: -1,
inspectionStandardListFlag: false,
standardHeader: {
site: '',
buNo: '',
attributeNo: '',
attributeType: 'A',
partDesc: '',
templateId: '',
inspectionTypeNo: '',
inspectionTypeName: ''
},
standardList: [],
sopData: {
site: '',
buNo: '',
partNo: '',
inspectionTypeNo: '',
inspectionTypeName: ''
},
sopList: [],
sopFileModelFlag: false,
partSopFileModelFlag: false,
partSopLoading: false,
ossVisible: false,
uploadLoading: false,
partSopCurrent: {
site: '',
partNo: ''
},
partSopList: [],
fileList2: [],
ossForm: {
remark: ''
},
sopColumnList: [
{
columnProp: 'fileName',
headerAlign: "center",
align: "center",
columnLabel: '文件名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
},
{
columnProp: 'createdBy',
headerAlign: "center",
align: 'center',
columnLabel: '上传人',
columnHidden: false,
columnImage: false,
columnSortable: true,
sortLv: 0,
status: true,
fixed: false
},
{
columnProp: 'createDate',
headerAlign: "center",
align: 'center',
columnLabel: '上传时间',
columnHidden: false,
columnImage: false,
columnSortable: true,
sortLv: 0,
status: true,
fixed: false
},
{
columnProp: 'orderRef3',
headerAlign: "center",
align: 'center',
columnLabel: '检验类型',
columnHidden: false,
columnImage: false,
columnSortable: true,
sortLv: 0,
status: true,
fixed: false
},
],
userBuList: [],
partInfoList: [],
partDetailData: {
bu: '',
partNo: '',
item: '',
partDesc: '',
seqNo: '',
sku: '',
cinvSourceCode:'',
},
authSearch: false,
authSave: false,
authUpdate: false,
authDelete: false,
authDetail: false,
authFile: false,
lineInspectionRoleFlag: false,
pqcInspectionTypeNo: '108',
menuId: this.$route.meta.menuId,
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 180
})
},
created () {
// 按钮控制
this.getButtonAuthData()
// 当前用户是否包含换线点检角色
this.lineInspectionRoleFlag = this.resolveLineInspectionRoleFlag()
// 获取用户的 site 和 bu
this.getSiteAndBuByUserName()
// 校验用户是否收藏
this.favoriteIsOk()
// 获取检验类型
this.inspectionTypeSearch()
// 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
if (!this.authSearch) {
// 获取数据列表
this.getDataList()
}
},
methods: {
// 获取用户的bu
getSiteAndBuByUserName () {
let tempData = {
username: this.$store.state.user.name,
site: this.$store.state.user.site,
}
getSiteAndBuByUserName(tempData).then(({data}) => {
if (data.code === 0) {
this.userBuList = data.rows
}
})
},
searchPartInfo () {
const query = {
...this.partDetailData,
site: this.$store.state.user.site,
bu: this.modalData.bu || this.partDetailData.bu || '',
partNo: (this.partDetailData.partNo || this.modalData.partNo || '').trim(),
item: (this.partDetailData.item || '').trim(),
partDesc: (this.partDetailData.partDesc || '').trim(),
sku: (this.partDetailData.sku || '').trim(),
cinvSourceCode: (this.partDetailData.cinvSourceCode || '').trim()
}
this.partDetailData = {
...this.partDetailData,
...query
}
this.partDisableFlag = true
this.dataListLoading = true
searchPartInfo(query).then(({data}) => {
if (data.code === 0) {
this.partInfoList = data.rows || []
} else {
this.partInfoList = []
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
}).catch(() => {
this.partInfoList = []
}).finally(() => {
this.dataListLoading = false
})
},
// 查询检验类型
inspectionTypeSearch () {
let tempData = {
site: this.$store.state.user.site
}
inspectionTypeSearch(tempData).then(({data}) => {
if (data.code === 0) {
this.options = data.rows
if (this.lineInspectionRoleFlag) {
const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
this.options = this.options.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo)
this.detailData.inspectionTypeNo = pqcInspectionTypeNo
this.sopData.inspectionTypeNo = pqcInspectionTypeNo
}
}
})
},
chooseLevel (row) {
this.tempLevelRow = row
this.getBaseList(208)
},
chooseProgrammeRow (row) {
this.tempProgrammeRow = row
this.getBaseList(207)
},
// 获取基础数据列表S
getBaseList (val,type) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
// if (val === 507) {
// strVal = this.modalData.partNo
// this.$refs.baseList.init(val, strVal)
// }
if (val === 208) {
strVal = this.tempLevelRow.samplingLevelNo
this.$refs.baseList.init(val, strVal)
}
if (val === 207) {
strVal = this.tempProgrammeRow.samplingProgrammeNo
this.$refs.baseList.init(val, strVal)
}
if (val === 1056) {
strVal = this.modalData.supplierNo
this.$refs.baseList.init(val, strVal)
}
})
},
// 列表方法的回调
getBaseData (val) {
if (this.tagNo === 507) {
this.modalData.partNo = val.part_no
this.modalData.item = val.item || ''
this.modalData.sku = val.sku || ''
this.modalData.partDesc = val.part_desc
}
if (this.tagNo === 208) {
this.tempLevelRow.samplingLevelNo = val.sampling_level_no
this.tempLevelRow.samplingLevelDesc = val.sampling_level_desc
}
if (this.tagNo === 207) {
this.tempProgrammeRow.samplingProgrammeNo = val.sampling_programme_no
this.tempProgrammeRow.samplingProgrammeDesc = val.sampling_programme_desc
}
if (this.tagNo === 1056) {
this.modalData.supplierNo = val.supplier_id
this.modalData.supplierDesc = val.supplier_name
}
},
// 获取数据列表
getDataList () {
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
qcPartAttributeSearch(this.searchData).then(({data}) => {
if (data.code === 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
}
})
},
getRowData1 (row) {
this.applyPartRowToModalData(row)
this.partDisableFlag = false
},
applyPartRowToModalData (row) {
if (!row) {
this.clearModalPartRelatedFields()
return
}
this.modalData.partNo = row.partNo || this.modalData.partNo || ''
this.modalData.item = row.item || ''
this.modalData.sku = row.sku || ''
this.modalData.cinvSourceCode = row.cinvSourceCode || ''
this.modalData.partDesc = row.partDesc || ''
},
clearModalPartRelatedFields () {
this.modalData.item = ''
this.modalData.sku = ''
this.modalData.cinvSourceCode = ''
this.modalData.partDesc = ''
},
async handleModalPartNoBlur () {
if (this.modalDisableFlag) {
return
}
const inputPartNo = (this.modalData.partNo || '').trim()
this.modalData.partNo = inputPartNo
if (!inputPartNo) {
this.clearModalPartRelatedFields()
return
}
const query = {
bu: this.modalData.bu || '',
partNo: inputPartNo,
item: '',
partDesc: '',
sku: '',
cinvSourceCode: ''
}
this._manualPartBlurSeq = (this._manualPartBlurSeq || 0) + 1
const seq = this._manualPartBlurSeq
try {
const { data } = await searchPartInfo(query)
if (seq !== this._manualPartBlurSeq) {
return
}
const rows = (data && data.code === 0 && Array.isArray(data.rows)) ? data.rows : []
const exactRow = rows.find(row => String(row.partNo || '').trim().toUpperCase() === inputPartNo.toUpperCase())
if (exactRow) {
this.applyPartRowToModalData(exactRow)
return
}
if (rows.length === 1) {
this.applyPartRowToModalData(rows[0])
return
}
this.clearModalPartRelatedFields()
} catch (e) {
if (seq === this._manualPartBlurSeq) {
this.clearModalPartRelatedFields()
}
}
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
addModal () {
this.modalData = {
site: '',
bu: this.userBuList[0].buNo,
flag: '1',
partNo: '',
item: '',
partDesc: '',
familyID: '',
familyName: '',
umid: '',
supplierNo: '',
supplierDesc: '',
attributeRemark: '',
createTime: '',
updateBy: this.$store.state.user.name,
createBy: this.$store.state.user.name,
attributeType: 'A',
exemptInspection: ''
}
this.modalDisableFlag = false
this.modalFlag = true
},
updateModal (row) {
this.modalData = {
site: row.site,
bu: buildQcBu(row.site),
flag: '2',
partNo: row.partNo,
item: row.item || '',
sku: row.sku || '',
partDesc: row.partDesc,
familyID: row.familyID,
familyName: row.familyName,
umid: row.umid,
supplierNo: row.supplierNo,
supplierDesc: row.supplierDesc,
attributeRemark: row.attributeRemark,
updateBy: this.$store.state.user.name,
createBy: this.$store.state.user.name,
attributeType: 'A',
exemptInspection: row.exemptInspection
}
this.modalDisableFlag = true
this.modalFlag = true
},
// 删除
deletePropertiesModel (row) {
this.$confirm(`是否删除这个检验模板?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
qcPartAttributeDelete(row).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
saveData () {
if (this.modalData.bu === '' || this.modalData.bu == null) {
this.$message.warning('请选择BU!')
return
}
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请选择产品编码!')
return
}
if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
this.$message.warning('请选择物料名称!')
return
}
// let obj = document.getElementsByName('isExemptInspection')
// let s = ''
// for (let i = 0; i < obj.length; i++) {
// if (obj[i].checked) {
// s += obj[i].value + ','
// }
// }
// s = s.substring(0, s.length - 1)
// this.modalData.exemptInspection = s
if (this.modalData.flag === '1') {
qcPartAttributeSave(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
} else {
qcPartAttributeEdit(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}
},
// 保存属性模板
saveDetail () {
for (let i = 0; i < this.detailList.length; i++) {
this.detailList[i].updateBy = this.$store.state.user.name
saveAttributeDetailed(this.detailList[i]).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.detailModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
}).then(() => {
return false
})
}
})
}
},
/**
* 加载「检验模板清单」表格;使用序号丢弃过期响应,避免打开弹框时的请求晚于「新增」关闭后的刷新而把列表覆盖成旧数据。
*/
loadTemplateDetailList () {
this._detailListLoadSeq = (this._detailListLoadSeq || 0) + 1
const seq = this._detailListLoadSeq
const param = {
site: this.detailData.site,
buNo: this.detailData.buNo,
partNo: this.detailData.partNo,
attributeNo: this.detailData.attributeNo || this.detailData.partNo,
attributeType: this.detailData.attributeType || 'A',
createBy: this.detailData.createBy,
inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : ''
}
return searchPartAttributeDetails(param).then(({ data }) => {
if (seq !== this._detailListLoadSeq) return
let rows = (data && data.rows) ? data.rows : []
if (this.lineInspectionRoleFlag) {
const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
rows = rows.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo || (item.inspectionTypeName && item.inspectionTypeName==='PQC'))
}
this.detailList = rows.slice()
})
},
// 打开物料模板清单
detailModal (row) {
this.detailData.site = row.site
this.detailData.buNo = row.buNo
this.detailData.partNo = row.partNo
this.detailData.attributeNo = row.partNo
this.detailData.attributeType = row.attributeType || 'A'
this.detailData.item = row.item || ''
this.detailData.sku = row.sku || ''
this.detailData.partDesc = row.partDesc
this.detailModelFlag = true
this.loadTemplateDetailList()
},
/**
* 打开“复制检验模板”弹窗。
*
* 业务意图:
* 1) 以当前行物料作为源物料;
* 2) 复制源物料“检验模板清单 + 检验标准明细”到多个目标物料;
* 3) 目标物料列表不按供应商过滤,仅查在用物料(status='Y')。
*/
openTemplateCopyDialog (row) {
const sourcePartNo = String((row && row.partNo) || '').trim()
const sourceBuNo = String((row && (row.buNo || row.bu_no)) || '').trim()
if (!sourcePartNo) {
this.$message.warning('请先选择要复制的源物料')
return
}
if (!sourceBuNo) {
this.$message.warning('源物料缺少BU信息,无法复制')
return
}
this.templateCopySource = {
site: this.$store.state.user.site,
buNo: sourceBuNo,
partNo: sourcePartNo,
partDesc: (row && row.partDesc) || '',
item: (row && row.item) || '',
sku: (row && row.sku) || ''
}
this.templateCopyDialogVisible = true
this.resetTemplateCopySearch()
},
/**
* 组装复制接口基础请求参数。
* 所有复制相关接口都要求携带 site + buNo + sourcePartNo,避免后端无法定位源模板主从记录。
*/
buildTemplateCopyBaseRequest () {
return {
site: this.templateCopySource.site || this.$store.state.user.site,
buNo: this.templateCopySource.buNo || '',
sourcePartNo: this.templateCopySource.partNo || ''
}
},
/**
* 重置模板复制筛选条件并重新加载候选物料。
* 说明:重置后立即查询,减少用户重复点击“查询”的操作成本。
*/
resetTemplateCopySearch () {
this.templateCopySearch = {
basePartNo: '',
partNo: '',
partDesc: '',
item: '',
sku: '',
categoryName: '',
categoryLevel2Name: '',
categoryLevel3Name: ''
}
this.queryTemplateCopyTargetPartList()
},
/**
* 模板复制弹窗关闭收尾:
* - 清空候选列表与勾选缓存,避免再次打开时残留旧状态;
* - 关闭时不重置源物料信息,便于调试和异常重试定位。
*/
handleTemplateCopyDialogClose () {
this.templateCopyRows = []
this.templateCopySelections = []
this.templateCopyDialogLoading = false
this.templateCopySubmitting = false
},
/**
* 查询模板复制候选物料列表。
*
* 后端约束:
* - 仅返回 status='Y' 物料;
* - 自动排除源物料;
* - 支持基准料号/物料名称/SKU/item/分类1~3筛选。
*/
async queryTemplateCopyTargetPartList () {
const baseReq = this.buildTemplateCopyBaseRequest()
if (!baseReq.sourcePartNo || !baseReq.buNo) {
this.templateCopyRows = []
return
}
this.templateCopyDialogLoading = true
this.templateCopySelections = []
try {
const req = Object.assign({}, baseReq, this.templateCopySearch)
const { data } = await listPartAttributeTemplateCopyTargetParts(req)
if (data && data.code === 0) {
this.templateCopyRows = data.rows || []
this.$nextTick(() => {
if (this.$refs.templateCopyTable && this.$refs.templateCopyTable.clearSelection) {
this.$refs.templateCopyTable.clearSelection()
}
})
return
}
this.templateCopyRows = []
this.$message.error((data && data.msg) || '查询候选物料失败')
} catch (err) {
this.templateCopyRows = []
this.$message.error((err && err.message) || '查询候选物料失败')
} finally {
this.templateCopyDialogLoading = false
}
},
/**
* 候选表行可选控制:
* 双保险排除源物料,避免用户误选自己导致“自复制”。
*/
templateCopyRowSelectable (row) {
const sourcePartNo = String(this.templateCopySource.partNo || '').trim().toUpperCase()
const currentPartNo = String((row && row.partNo) || '').trim().toUpperCase()
if (!currentPartNo) {
return false
}
return currentPartNo !== sourcePartNo
},
/**
* 记录用户在候选表中的多选结果。
*/
handleTemplateCopySelectionChange (rows) {
this.templateCopySelections = rows || []
},
/**
* 将冲突提示文本做HTML转义,避免异常字符影响确认弹窗渲染。
*/
escapeTemplateCopyConfirmText (val) {
return String(val || '')
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
},
/**
* 构造“已存在模板”确认弹窗内容:
* - 明确提示将进行覆盖;
* - 列出全部冲突物料,避免误覆盖。
*/
buildTemplateCopyConflictConfirmHtml (conflictRows) {
const rowHtml = (conflictRows || []).map((row, index) => {
const partNo = this.escapeTemplateCopyConfirmText(row.partNo)
const partDesc = this.escapeTemplateCopyConfirmText(row.partDesc)
const item = this.escapeTemplateCopyConfirmText(row.item)
const sku = this.escapeTemplateCopyConfirmText(row.sku)
return `${index + 1}. ${partNo} / ${item} / ${sku} `
}).join('<br/>')
return `以下物料已经有检验模板,是否覆盖?<br/><div style="margin-top:8px;max-height:260px;overflow-y:auto;line-height:1.6;">${rowHtml}</div>`
},
/**
* 执行确认复制
* 1) 先调后端冲突校验
* 2) 若有冲突先让用户确认是否覆盖
* 3) 覆盖时后端先删目标主从记录再复制源主从记录
*/
async submitTemplateCopy () {
const targetPartNos = (this.templateCopySelections || [])
.map(row => String((row && row.partNo) || '').trim())
.filter(partNo => partNo)
if (targetPartNos.length === 0) {
this.$message.warning('请至少选择一个目标物料')
return
}
if (this.templateCopySubmitting) {
return
}
this.templateCopySubmitting = true
try {
const checkReq = Object.assign({}, this.buildTemplateCopyBaseRequest(), {
targetPartNos
})
const { data } = await checkPartAttributeTemplateCopyConflicts(checkReq)
if (!data || data.code !== 0) {
throw new Error((data && data.msg) || '复制冲突校验失败')
}
const conflictRows = data.rows || []
if (conflictRows.length > 0) {
this.templateCopySubmitting = false
const confirmHtml = this.buildTemplateCopyConflictConfirmHtml(conflictRows)
try {
await this.$confirm(confirmHtml, '提示', {
confirmButtonText: '确认覆盖',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
})
} catch (confirmError) {
return
}
this.templateCopySubmitting = true
await this.executeTemplateCopy(targetPartNos, true)
return
}
await this.executeTemplateCopy(targetPartNos, false)
} catch (err) {
this.$message.error((err && err.message) || '复制失败')
} finally {
this.templateCopySubmitting = false
}
},
/**
* 调用后端复制接口落库。
*
* @param targetPartNos 目标物料编码集合
* @param overwriteExisting 是否覆盖目标已有模板
*/
async executeTemplateCopy (targetPartNos, overwriteExisting) {
const req = Object.assign({}, this.buildTemplateCopyBaseRequest(), {
targetPartNos,
overwriteExisting,
submitBy: this.$store.state.user.name
})
const { data } = await copyPartAttributeTemplateToParts(req)
if (data && data.code === 0) {
this.$message.success('复制成功')
this.templateCopyDialogVisible = false
return
}
throw new Error((data && data.msg) || '复制失败')
},
checkInspectionType () {
if (this.lineInspectionRoleFlag) {
this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
}
this.operationData.inspectionTypeNo = this.detailData.inspectionTypeNo
getPartTemplateLists(this.detailData).then(({data}) => {
this.operation = ''
this.resourceId = ''
this.itemList1 = data.row1
this.itemList2 = data.row2
})
},
// 快速新增
addFastModal () {
this.itemSelections1 = null
this.itemSelections2 = null
if (this.lineInspectionRoleFlag) {
this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
}
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
if (this.lineInspectionRoleFlag) {
this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
} else if (this.options.length > 0) {
this.detailData.inspectionTypeNo = this.options[0].inspectionTypeNo
} else {
this.detailData.inspectionTypeNo = ''
}
this.checkInspectionType()
this.dataListOperationSelections = []
this.operation = ''
this.resourceId = ''
this.operationData.operationDesc = ''
this.resourceData.resourceId = ''
this.resourceData.resourceDesc = ''
this.operationCurrent = -1
this.resourceCurrent = -1
this.selectionManufacturer = []
this.dataListManufacturerSelections = []
this.fastAddFlag = true
},
// 可选项目
itemClickRow1 (row) {
this.$refs.itemTable1.toggleRowSelection(row)
},
// 已有项目
itemClickRow2 (row) {
this.$refs.itemTable2.toggleRowSelection(row)
},
selectFlag () {
return true
},
selectionItem1 (val) {
if (val.length > 1) {
const last = val[val.length - 1]
this.$refs.itemTable1.clearSelection()
this.$refs.itemTable1.toggleRowSelection(last, true)
this.itemSelections1 = [last]
} else {
this.itemSelections1 = val
}
},
selectionItem2 (val) {
this.itemSelections2 = val
},
// 添加模板
addItem () {
if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
this.$message.warning('请选择可选模板!')
return
}
if (this.itemSelections1.length > 1) {
this.$message.warning('每次只能添加一个模板!')
return
}
const selectedTemplateId = this.itemSelections1[0].templateId
const existingTemplateIds = new Set([
...(this.itemList2 || []).map(item => item.templateId),
...(this.detailList || []).map(item => item.templateId)
])
if (existingTemplateIds.has(selectedTemplateId)) {
this.$message.warning(`模板编码【${selectedTemplateId}】已存在,不能重复添加!`)
return
}
const currentInspectionTypeNo = (this.detailData.inspectionTypeNo || '').trim()
if (currentInspectionTypeNo) {
const hasSameInspectionType = (this.detailList || []).some(item => String(item.inspectionTypeNo || '').trim() === currentInspectionTypeNo)
if (hasSameInspectionType) {
this.$message.warning('同一个物料同一个检验类型只能维护一个模板!')
return
}
}
if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107' || this.detailData.inspectionTypeNo === '108') && (this.operation == null || this.operation === '')) {
this.$message.warning('请选择工序!')
return
}
if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107') && (this.resourceId == null || this.resourceId === '')) {
this.$message.warning('请选择机台!')
return
}
let inData = {
site: this.detailData.site,
buNo: this.detailData.buNo,
attributeNo: this.detailData.partNo,
itemList: [this.itemSelections1[0]],
operation: this.operation,
resourceID: this.resourceId,
manufacturerList: ['*'],
attributeType: this.detailData.attributeType,
inspectionTypeNo: this.detailData.inspectionTypeNo,
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name
}
savePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) {
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.loadTemplateDetailList()
this.itemSelections1 = []
this.operation = ''
this.resourceId = ''
this.selectionManufacturer = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 删除模板
deleteItem () {
if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
this.$message.warning('请选择已有模板!')
return
}
let inData = {
attributeNo:this.detailData.partNo,
itemList: this.itemSelections2,
attributeType: this.detailData.attributeType,
site: this.detailData.site,
buNo: this.detailData.buNo,
}
deletePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) {
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.loadTemplateDetailList()
this.itemSelections2 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 关闭「新增」弹框后刷新父弹框清单(与 loadTemplateDetailList 共用防竞态逻辑)
refreshDetailList () {
if (!this.detailModelFlag) return
this.loadTemplateDetailList()
},
// 删除物料属性中的模板
deletePartAttributeDetails (row) {
this.$confirm(`是否删除这个检验模板?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePartAttributeDetails(row).then(({data}) => {
if (data && data.code === 0) {
this.loadTemplateDetailList()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
// 物料模板检验标准弹窗
inspectionStandardListModal (row) {
this.standardHeader = {
site: row.site || this.detailData.site,
buNo: row.buNo || this.detailData.buNo,
attributeNo: this.detailData.partNo,
attributeType: this.detailData.attributeType || 'A',
partDesc: this.detailData.partDesc,
templateId: row.templateId,
inspectionTypeNo: row.inspectionTypeNo || '',
inspectionTypeName: row.inspectionTypeName || ''
}
let req = {
site: this.standardHeader.site,
buNo: this.standardHeader.buNo,
attributeNo: this.standardHeader.attributeNo,
templateId: this.standardHeader.templateId
}
qcAttributeTemplateItemDetailsSearch(req).then(({data}) => {
if (data && data.code === 0) {
this.standardList = data.rows || []
this.inspectionStandardListFlag = true
} else {
this.$alert(data.msg || '查询失败', '错误', {
confirmButtonText: '确定'
})
}
})
},
// 保存物料模板检验标准
saveStandardList () {
if (!this.standardHeader.templateId) {
this.$message.warning('请先选择模板!')
return
}
if (this.standardList == null || this.standardList.length === 0) {
this.$message.warning('当前模板没有可保存的检验项目!')
return
}
let req = {
site: this.standardHeader.site,
buNo: this.standardHeader.buNo,
attributeNo: this.standardHeader.attributeNo,
attributeType: this.standardHeader.attributeType,
templateId: this.standardHeader.templateId,
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
itemList: this.standardList.map(item => ({
itemNo: item.itemNo,
defaultValue: item.defaultValue,
maxValue: item.maxValue,
minValue: item.minValue,
orderId: item.orderId
}))
}
qcAttributeTemplateItemSave(req).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
this.inspectionStandardListFlag = false
} else {
this.$alert(data.msg || '保存失败', '错误', {
confirmButtonText: '确定'
})
}
})
},
// 校验用户是否收藏
favoriteIsOk () {
let userFavorite = {
userId: this.$store.state.user.id,
languageCode: this.$i18n.locale
}
userFavoriteList(userFavorite).then(({data}) => {
for (let i = 0; i < data.list.length; i++) {
if (this.$route.meta.menuId === data.list[i].menuId) {
this.favorite = true
}
}
})
},
// 收藏 OR 取消收藏
favoriteFunction () {
let userFavorite = {
userId: this.$store.state.user.id,
functionId: this.$route.meta.menuId,
}
if (this.favorite) {
removeUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = false
})
} else {
// 收藏
saveUserFavorite(userFavorite).then(({data}) => {
this.$message.success(data.msg)
this.favorite = true
})
}
},
//导出excel
async createExportData() {
this.searchData.limit = -1
this.searchData.page = 1
await qcPartAttributeSearch(this.searchData).then(({data}) => {
this.exportList= data.page.list
})
return this.exportList
},
startDownload() {},
finishDownload() {},
fields () {
let json = "{"
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
// 导入
qcUpload () {
let currentData = {
flag: 'partAttribute',
createBy: this.$store.state.user.name,
site: this.$store.state.user.site,
}
//打开组件 去做新增业务
this.$nextTick(() => {
this.$refs.qcUpload.init(currentData)
})
},
// 获取工序列表
getOperationList () {
getOperationDescList(this.operationData).then(({data}) => {
if (data && data.code === 0) {
this.operationList = data.rows
// // 回显数据
// // 先清空缓存选中
// this.$nextTick(() => this.$refs.operationTable.clearSelection())
// // 拿到选中的工序
// let tempDataList = this.operationDesc
// this.operationList.forEach(val => {
// // 回显选中的工序
// if (tempDataList === val.operationDesc) {
// this.$nextTick(() => this.$refs.operationTable.toggleRowSelection(val, true))
// }
// })
this.operationModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 获取机台列表
getAllResourceList () {
this.resourceData.site = this.detailData.site
getAllResourceList(this.resourceData).then(({data}) => {
if (data && data.code === 0) {
this.resourceList = data.rows
this.resourceModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 条件查询获取工序列表
getOperationList2 () {
getOperationDescList(this.operationData).then(({data}) => {
if (data && data.code === 0) {
this.operationList = data.rows
this.operationCurrent = -1
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 条件查询获取机台列表
getAllResourceList2 () {
this.resourceData.site = this.detailData.site
getAllResourceList(this.resourceData).then(({data}) => {
if (data && data.code === 0) {
this.resourceList = data.rows
this.resourceCurrent = -1
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 点击行选中工序复选框
operationClickRow (row) {
this.$refs.operationTable.toggleRowSelection(row)
},
// 点击行选中机台复选框
resourceClickRow (row) {
this.$refs.resourceTable.toggleRowSelection(row)
},
// 多选工序
selectionOperationChangeHandle (val) {
this.operation = val[0].operationDesc
if (val) {
this.operationCurrent = val.index
}
},
// 多选机台
selectionResourceChangeHandle (val) {
this.resourceId = val[0].resourceId
if (val) {
this.resourceCurrent = val.index
}
},
operationRowClassName ({row, rowIndex}) {
row.index = rowIndex // 在原有的数据上加一个index
},
resourceRowClassName ({row, rowIndex}) {
row.index = rowIndex // 在原有的数据上加一个index
},
// // 单选
// clickChange (row) {
// this.radioOperation = row.operationDesc
// },
// 确认选择工序
confirmOperation () {
//this.operationDesc = ''
// this.operationDesc = this.radioOperation
// this.radioOperation = ''
// for (let i = 0; i < this.dataListOperationSelections.length; i++) {
// this.selectionOperation.push(this.dataListOperationSelections[i].operationDesc)
// }
this.operationModelFlag = false
},
// 确认选择工序
confirmResource () {
this.resourceModelFlag = false
},
// 获取供应商列表
getManufacturerList () {
this.manufacturerData.site = this.detailData.site
getManufacturerList(this.manufacturerData).then(({data}) => {
if (data && data.code === 0) {
this.manufacturerList = data.rows
// 回显数据
// 先清空缓存选中
this.$nextTick(() => this.$refs.manufacturerTable.clearSelection())
// 拿到选中的供应商
let tempDataList = this.selectionManufacturer
this.manufacturerList.forEach(val => {
// 回显选中的供应商
if (tempDataList.includes(val.manufacturerID)) {
this.$nextTick(() => this.$refs.manufacturerTable.toggleRowSelection(val, true))
}
})
this.manufacturerModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 点击行选中复选框
manufacturerClickRow (row) {
this.$refs.manufacturerTable.toggleRowSelection(row)
},
// 多选
selectionManufacturerChangeHandle (val) {
this.dataListManufacturerSelections = val
},
// 确认多选供应商
confirmManufacturer () {
this.selectionManufacturer = []
for (let i = 0; i < this.dataListManufacturerSelections.length; i++) {
this.selectionManufacturer.push(this.dataListManufacturerSelections[i].manufacturerID)
}
this.manufacturerModelFlag = false
},
// sop文件列表
sopFileList (row) {
this.sopData = {
site: row.site,
buNo: row.buNo,
partNo: row.partNo,
inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : ''
}
this.getFileContentList()
},
getFileContentList () {
if (this.lineInspectionRoleFlag) {
this.sopData.inspectionTypeNo = this.getPqcInspectionTypeNo()
}
let tempData = {
orderRef1: this.sopData.site,
orderRef2: this.sopData.partNo,
orderRef3:this.sopData.inspectionTypeNo,
orderRef4: this.sopData.buNo,
}
getFileContentList(tempData).then(({data}) => {
if (data && data.code === 200) {
this.sopList = data.rows
} else {
this.sopList = []
}
})
this.sopFileModelFlag = true
},
// 上传sop文件模态框
uploadSopFile () {
let currentData = {
titleCon: 'SOP文件上传',
site: this.sopData.site,
buNo: this.sopData.buNo,
createBy: this.$store.state.user.name,
partNo: this.sopData.partNo,
inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : '',
options: this.options
}
//打开组件 去做新增业务
this.$nextTick(() => {
this.$refs.qcSOPUploadFile.init(currentData)
})
},
// 文件下载
downloadFile (row) {
downLoadObjectFile(row).then(({data}) => {
// 不限制文件下载类型
const blob = new Blob([data], {type: "application/octet-stream"})
// 下载文件名称
const fileName = row.fileName
// a标签下载
const linkNode = document.createElement('a')
// a标签的download属性规定下载文件的名称
linkNode.download = fileName
linkNode.style.display = 'none'
// 生成一个Blob URL
linkNode.href = URL.createObjectURL(blob)
document.body.appendChild(linkNode)
// 模拟在按钮上的一次鼠标单击
linkNode.click()
// 释放URL 对象
URL.revokeObjectURL(linkNode.href)
document.body.removeChild(linkNode)
})
},
// 删除文件
deleteFile (row) {
this.$confirm('确定要删除此文件?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteObjectFile(row).then(({data}) => {
if (data && data.code === 0) {
this.getFileContentList()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
// 物料SOP文件列表
openPartSopFileList (row) {
this.partSopCurrent = {
site: row.site,
partNo: row.partNo
}
this.fetchPartSopList()
this.partSopFileModelFlag = true
},
fetchPartSopList () {
if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
this.partSopList = []
return
}
const params = {
orderRef1: this.partSopCurrent.site,
orderRef2: this.partSopCurrent.partNo,
orderRef3: '',
orderReftype: 'PartSop'
}
this.partSopLoading = true
queryOssFilePlus(params).then(({data}) => {
if (data && data.code === 0) {
this.partSopList = data.rows || []
} else {
this.partSopList = []
}
}).catch(() => {
this.partSopList = []
}).finally(() => {
this.partSopLoading = false
})
},
openPartSopUploadDialog () {
if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
this.$message.warning('请先选择物料')
return
}
this.fileList2 = []
this.ossForm.remark = ''
this.ossVisible = true
this.$nextTick(() => {
if (this.$refs.upload) {
this.$refs.upload.clearFiles()
}
})
},
onRemoveFile (file, fileList) {
this.fileList2 = fileList
},
onChangeFile (file, fileList) {
this.fileList2 = fileList
},
handleUploadFiles () {
if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
this.$message.warning('请先选择物料')
return
}
if (!this.fileList2 || this.fileList2.length === 0) {
this.$message.warning('请选择文件')
return
}
let formData = new FormData()
for (let i = 0; i < this.fileList2.length; i++) {
formData.append('file', this.fileList2[i].raw)
}
formData.append('orderRef1', this.partSopCurrent.site)
formData.append('orderRef2', this.partSopCurrent.partNo)
formData.append('orderRef3', '')
formData.append('createdBy', this.$store.state.user.name)
formData.append('CAdditionalInfo', this.ossForm.remark || '')
formData.append('orderReftype', 'PartSop')
this.uploadLoading = true
ossUploadNoSaveOSSForYJY(formData).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('上传成功')
this.ossVisible = false
this.fileList2 = []
this.ossForm.remark = ''
this.fetchPartSopList()
} else {
this.$message.warning(data.msg || '上传失败')
}
}).catch(() => {
this.$message.error('上传失败')
}).finally(() => {
this.uploadLoading = false
})
},
previewPartSopFile (row) {
let params = {
id: row.id
}
previewOssFileById(params).then((response) => {
const contentType = (response.headers && response.headers['content-type']) || 'application/octet-stream'
const blob = new Blob([response.data], { type: contentType })
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.setAttribute('download', row.fileName)
link.target = '_blank'
link.click()
URL.revokeObjectURL(link.href)
})
},
removePartSopFile (row) {
this.$confirm('确定要删除该文件吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeOss([row.id]).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('删除成功')
this.fetchPartSopList()
} else {
this.$message.warning(data.msg || '删除失败')
}
})
}).catch(() => {
})
},
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn (tableId, columnId) {
let queryTableUser = {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: tableId,
status: true,
languageCode: this.$i18n.locale
}
await getTableUserListLanguage(queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
//this.columnList1 = []
switch (columnId) {
case 1:
this.columnList = data.rows
break;
case 2:
this.columnDetailList = data.rows
break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
}
} else {
this.getColumnList(tableId, columnId)
}
})
},
// 获取 tableDefault 列
async getColumnList (tableId, columnId) {
let queryTable = {
functionId: this.$route.meta.menuId,
tableId: tableId,
languageCode: this.$i18n.locale
}
await getTableDefaultListLanguage(queryTable).then(({data}) => {
if (!data.rows.length == 0) {
switch (columnId) {
case 1:
this.columnList = data.rows
break;
case 2:
this.columnDetailList = data.rows
break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
}
} else {
// this.showDefault = true.
}
})
},
closeDialog () {
this.partDetailData = {
partNo: '',
item: '',
partDesc: '',
seqNo: '',
sku: '',
}
this.partInfoList = []
},
//获取按钮的权限数据
getButtonAuthData () {
let searchFlag = this.isAuth(this.menuId+":search")
let saveFlag = this.isAuth(this.menuId+":save")
let updateFlag = this.isAuth(this.menuId+":update")
let deleteFlag = this.isAuth(this.menuId+":delete")
let detailFlag = this.isAuth(this.menuId+":detail")
let fileFlag = this.isAuth(this.menuId+":file")
//处理页面的权限数据
this.authSearch = !searchFlag
this.authSave = !saveFlag
this.authUpdate = !updateFlag
this.authDelete = !deleteFlag
this.authDetail = !detailFlag
this.authFile = !fileFlag
},
// 是否包含换线点检角色
resolveLineInspectionRoleFlag () {
return this.$store.state.user.lineInspectionRoleFlag === true || localStorage.getItem('lineInspectionRoleFlag') === 'Y'
},
// 获取PQC对应的检验类型编码
getPqcInspectionTypeNo () {
const pqcData = this.options.find(item => item.inspectionTypeName && item.inspectionTypeName==='PQC')
if (pqcData) {
this.pqcInspectionTypeNo = pqcData.inspectionTypeNo
}
return this.pqcInspectionTypeNo
},
}
}
</script>
<style scoped>
.el-table /deep/ .cell{
height: auto;
line-height: 1.5;
}
.rq .auto /deep/ .el-form-item__content {
height: auto;
line-height: 1.5;
}
</style>