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.
 
 
 
 
 

3762 lines
127 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.buNo" placeholder="请选择" clearable style="width: 130px">
<el-option
v-for = "i in buList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buNo">
</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="'物料描述'">
<el-input v-model="searchData.partDesc" clearable style="width: 210px"></el-input>
</el-form-item>
<el-form-item :label="'录入时间'">
<el-date-picker
style="width: 120px"
v-model="searchData.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item style="margin-top: 23px;">
<label style="margin-left: 0px;font-size: 19px">&#10142</label>
</el-form-item>
<el-form-item :label="' '">
<el-date-picker
style="width: 120px"
v-model="searchData.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="' '">
<el-button v-if="!authSearch" @click="getDataList">查询</el-button>
<el-button v-if="!authSave" type="primary" @click="addModal">新增</el-button>
<!-- <el-button type="primary" @click="delModal()">删除</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
@header-dragend="handleColumnResize"
:height="height"
:data="dataList"
border
ref="partTable"
:row-style="rowStyle"
@row-click="partClickRow"
@selection-change="selectionPart"
@current-change="changeCurrentRow"
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">{{ 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">
<el-link v-if="!authUpdate" style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
<el-dropdown trigger="click">
<el-link style="cursor: pointer;font-size: 12px">
更多
</el-link >
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="toMenu('BOM',scope.row)">BOM</el-dropdown-item>
<el-dropdown-item @click.native="toMenu('Routing',scope.row)">Routing</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<selectDiv ref="selectDiv"></selectDiv>
<!-- 分页插件 -->
<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="modalData.title" top="10vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="1000px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules">
<el-form-item label="物料编码" prop="partNo">
<el-input v-model="modalData.partNo" disabled style="width: 128px"></el-input>
</el-form-item>
<el-form-item label="物料描述" prop="partDesc" style="margin-left: -10px">
<el-input v-model="modalData.partDesc" clearable style="width: 346px"></el-input>
</el-form-item>
<el-form-item label="物料描述(英文)">
<el-input v-model="modalData.partDesceEn" style="width: 477px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item prop="spec" label="规格">
<el-input v-model="modalData.spec" style="width: 477px"></el-input>
</el-form-item>
<el-form-item label="BU" prop="bu">
<el-select v-model="modalData.bu" placeholder="请选择" @change="getPreviousPartNo" :disabled="modalDisableFlag" style="width: 90px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="active" label="是否在用">
<el-select v-model="modalData.active" style="width: 80px">
<el-option label="是" value="Y"></el-option>
<el-option label="否" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="partType2" label="零件类型">
<el-select v-model="modalData.partType2" style="width: 120px">
<el-option label="成品" value="Manufactured"></el-option>
<el-option label="半成品" value="Manufactured Recipe"></el-option>
<el-option label="原材料" value="Purchased (raw)"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="modalData.flag === '2'" :label="' '">
<el-button type="primary" @click="toCopyPartModal">Copy</el-button>
</el-form-item>
<el-form-item v-if="modalData.flag === '1'" style="margin-top: 23px">
<el-checkbox v-model="modalData.tblBaseFlag" true-label="Y">复制属性({{previousPartNo}})</el-checkbox>
</el-form-item>
</el-form>
<el-tabs v-model="inventoryPartTable" style="width: 100%;height: 305px;" type="border-card" @tab-click="inventoryPartClick">
<el-tab-pane label="General" name="General">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item prop="umId2">
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a herf="#">计量单位</a></span>
<el-input v-model="modalData.umId2" @blur="umIdBlur(510)" style="width: 128px"></el-input>
<el-input v-model="modalData.umName" disabled style="width: 330px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(214)"><a herf="#">物料分类</a></span>
<el-input v-model="modalData.familyID" @blur="partFamilyBlur(214)" style="width: 128px"></el-input>
<el-input v-model="modalData.familyName" disabled style="width: 330px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(211)"><a herf="#">商品组1</a></span>
<el-input v-model="modalData.productGroupId1" @blur="productGroupId1Blur(211)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName1" disabled style="width: 330px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(212)"><a herf="#">商品组2</a></span>
<el-input v-model="modalData.productGroupId2" @blur="productGroupId2Blur(212)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName2" disabled style="width: 330px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(213)"><a herf="#">商品组3</a></span>
<el-input v-model="modalData.productGroupId3" @blur="productGroupId3Blur(213)" style="width: 128px"></el-input>
<el-input v-model="modalData.productGroupName3" disabled style="width: 330px"></el-input>
</el-form-item>
<el-form-item>
<span style="cursor: pointer" slot="label" @click="getBaseList(219)"><a herf="#">属性模板</a></span>
<el-input v-model="modalData.codeNo" @blur="modelBlur(219)" style="width: 128px"></el-input>
<el-input v-model="modalData.codeDesc" disabled style="width: 330px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-top: -5px;">
<el-form-item label="备注" style="height: 135px">
<el-input type="textarea" v-model="modalData.remark" :rows="5" resize='none' show-word-limit style="width: 939px"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
</el-form>
<el-footer style="height:35px;margin-top: 20px;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-tabs v-model="activeTable" style="width: 100%" type="border-card" @tab-click="tabClick" class="customer-tab">
<!-- 物料属性页签 -->
<el-tab-pane label="物料属性" name="part_item">
<el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
<el-button type="primary" @click="addOrDelItem">新增</el-button>
<el-button type="primary" :loading="loading" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>
</el-form>
<div class="rq " v-if="attributeDialog">
<el-table
:data="partItemList"
:height="secondHeight-50"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnItemList" :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">
<div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
<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>
</div>
<div v-else>
<template v-if="item.columnProp==='textValue' && scope.row.valueTypeDb==='T'">
{{ scope.row['textValue'] }}
</template>
<template v-else-if="item.columnProp==='textValue' && scope.row.valueTypeDb==='N'">
{{ scope.row['numValue'] }}
</template>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="rq " v-else>
<el-table
:data="copyAttributeList"
:height="secondHeight-50"
border
style="width: 100%">
<el-table-column
v-for="(item,index) in columnItemList" :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">
<div v-if="item.columnProp !== 'textValue' && item.columnProp !== 'numValue'">
<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>
</div>
<div v-else>
<div v-if="scope.row.valueChooseFlag !== 'Y'">
<el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueTypeDb === 'N'" :controls="false"></el-input-number>
<el-input v-model="scope.row.textValue" v-else></el-input>
</div>
<div v-else>
<el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue">
<el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
</el-select>
<el-select style="width: 100%;" v-else v-model="scope.row.numValue">
<el-option :value="i.availableValue" :label="i.availableValue" v-for="(i,key) in scope.row.availableValueList" :key="key"></el-option>
</el-select>
</div>
</div>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<!-- 代理商页签 -->
<el-tab-pane label="代理商" name="part_agent">
<el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
<el-button type="primary" @click="savePartAgent">新增</el-button>
</el-form>
<el-table
:data="partAgentList"
:height="secondHeight-50"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnAgentList" :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
header-align="center"
align="center"
width="100"
fixed="right"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="deleteAgent2(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<!-- 制造商页签 -->
<el-tab-pane label="制造商" name="part_manufacturer">
<el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
<el-button type="primary" @click="savePartManufacturer">新增</el-button>
</el-form>
<el-table
:data="partManufacturerList"
:height="secondHeight-50"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnManufacturerList" :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
header-align="center"
align="center"
width="100"
fixed="right"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="deleteManufacturer2(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<!-- 默认库位页签 -->
<el-tab-pane label="默认库位" name="default_locations">
<el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
<el-button type="primary" @click="saveDefaultLocation()">新增</el-button>
</el-form>
<el-table
:data="defaultLocationList"
:height="secondHeight-50"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnLocationList" :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
header-align="center"
align="center"
width="100"
fixed="right"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="deleteLocation2(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<!-- 文档页签 -->
<el-tab-pane label="文档" name="part_file">
<el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
<el-button type="primary" @click="uploadFile">上传文件</el-button>
</el-form>
<el-table
:data="fileContentList"
:height="secondHeight-50"
border
style="width: 100%; ">
<el-table-column
v-for="(item,index) in columnFileList" :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="130"
label="操作">
<template slot-scope="scope">
<el-link style="cursor: pointer" @click="previewFile(scope.row)">预览</el-link>
<el-link style="cursor: pointer" @click="downloadFile(scope.row)">下载</el-link>
<el-link style="cursor: pointer" @click="deleteFile(scope.row)">删除</el-link>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<!-- 物料属性值编辑模态框 -->
<el-dialog title="物料属性" :close-on-click-modal="false" v-drag :visible.sync="updateItemModelFlag" width="1000px">
<div class="rq ">
<el-table
:data="updatePartItemList"
height="350px"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in updateColumnItemList" :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="textValue"
header-align="center"
align="right"
min-width="80"
label="文本值">
<template slot-scope="scope">
<el-input v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.textValue" style="height: 11px;width:98%"></el-input>
<el-select v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.textValue" style="width: 180px" placeholder="请选择">
<el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
</el-select>
<el-input v-if="scope.row.valueTypeDb !== 'T'" v-model="scope.row.textValue" disabled style="height: 11px;width:98%"></el-input>
</template>
</el-table-column>
<el-table-column
prop="numValue"
header-align="center"
align="right"
min-width="80"
label="数字值">
<template slot-scope="scope">
<el-input v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.numValue" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
<el-select v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.numValue" style="width: 180px" placeholder="请选择">
<el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
</el-select>
<el-input v-if="scope.row.valueTypeDb !== 'N'" v-model="scope.row.numValue" disabled style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="commitItemValue()">保存</el-button>
<el-button type="primary" @click="updateItemModelFlag=false">关闭</el-button>
</span>
</el-dialog>
<!-- 物料属性-> 快速新增 -->
<el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1000px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="itemData">
<el-form-item :label="'属性编码'">
<el-input v-model="itemData.propertiesItemNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'属性名称'">
<el-input v-model="itemData.itemDesc" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryPartItem()">查询</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 350px;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"
width="50">
</el-table-column>
<el-table-column
prop="itNo"
header-align="center"
align="center"
min-width="80"
label="属性编码">
</el-table-column>
<el-table-column
prop="itemDesc"
header-align="center"
align="center"
min-width="200"
label="属性名称">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 10px;padding: 1px">
<div style="margin-top: 200px;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: 350px;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"
width="50">
</el-table-column>
<el-table-column
prop="itNo"
header-align="center"
align="center"
min-width="80"
label="属性编码">
</el-table-column>
<el-table-column
prop="itemDesc"
header-align="center"
align="center"
min-width="200"
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="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="agentModelFlag" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="agentData">
<el-form-item :label="'代理商编码'">
<el-input v-model="agentData.agentId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'代理商名称'">
<el-input v-model="agentData.agentName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getAgentList">查询</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 350px; padding: 1px">
<span style="font-size: 12px" >可选代理商:</span>
<el-table
height="400px"
:data="agentList1"
border
ref="agentTable1"
@row-click="agentClickRow1"
@selection-change="selectionAgent1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="agentId"
header-align="center"
align="center"
min-width="80"
label="代理商编码">
</el-table-column>
<el-table-column
prop="agentName"
header-align="center"
align="center"
min-width="120"
label="代理商名称">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: -1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addAgent">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteAgent">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 350px;padding: 1px">
<span style="font-size: 12px" >已有代理商:</span>
<el-table
height="400px"
:data="agentList2"
border
ref="agentTable2"
@row-click="agentClickRow2"
@selection-change="selectionAgent2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="agentId"
header-align="center"
align="center"
min-width="80"
label="代理商编码">
</el-table-column>
<el-table-column
prop="agentName"
header-align="center"
align="center"
min-width="120"
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="agentModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 制造商-> 快速新增 -->
<el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="900px">
<div style="font-size: 12px">
<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>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 350px; padding: 1px">
<span style="font-size: 12px" >可选制造商:</span>
<el-table
height="400px"
:data="manufacturerList1"
border
ref="manufacturerTable1"
@row-click="manufacturerClickRow1"
@selection-change="selectionManufacturer1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="manufacturerId"
header-align="center"
align="center"
min-width="80"
label="制造商编码">
</el-table-column>
<el-table-column
prop="manufacturerName"
header-align="center"
align="center"
min-width="120"
label="制造商名称">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: -1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addManufacturer()">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteManufacturer()">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 350px;padding: 1px">
<span style="font-size: 12px" >已有制造商:</span>
<el-table
height="400px"
:data="manufacturerList2"
border
ref="manufacturerTable2"
@row-click="manufacturerClickRow2"
@selection-change="selectionManufacturer2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="manufacturerId"
header-align="center"
align="center"
min-width="80"
label="制造商编码">
</el-table-column>
<el-table-column
prop="manufacturerName"
header-align="center"
align="center"
min-width="120"
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="manufacturerModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 默认库位-> 快速新增 -->
<el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="locationModelFlag" width="900px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="locationData">
<el-form-item :label="'库位编码'">
<el-input v-model="locationData.locationId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'库位名称'">
<el-input v-model="locationData.locationName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="getLocationList()">查询</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 350px; padding: 1px">
<span style="font-size: 12px" >可选库位:</span>
<el-table
height="400px"
:data="locationList1"
border
ref="locationTable1"
@row-click="locationClickRow1"
@selection-change="selectionLocation1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="locationId"
header-align="center"
align="center"
min-width="80"
label="库位编码">
</el-table-column>
<el-table-column
prop="locationName"
header-align="center"
align="center"
min-width="120"
label="库位名称">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 111px;padding: -1px">
<div style="margin-top: 182px;margin-left: 18px">
<el-button type="primary" @click="addLocation()">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteLocation()">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 350px;padding: 1px">
<span style="font-size: 12px" >已有库位:</span>
<el-table
height="400px"
:data="locationList2"
border
ref="locationTable2"
@row-click="locationClickRow2"
@selection-change="selectionLocation2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="locationId"
header-align="center"
align="center"
min-width="80"
label="库位编码">
</el-table-column>
<el-table-column
prop="locationName"
header-align="center"
align="center"
min-width="120"
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="locationModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- copyPart -->
<el-dialog title="Copy Part" :close-on-click-modal="false" v-drag :visible.sync="copyPartModelFlag" width="500px">
<fieldset style="width: 474px">
<legend>Part No To Copy</legend>
<el-form :inline="true" style="margin-left: 7px">
<el-form-item label="From Part">
<el-input v-model="modalData.partNo" readonly style="width: 140px"></el-input>
<el-input v-model="modalData.partDesc" readonly style="width: 287px"></el-input>
</el-form-item>
<el-form-item label="To Part">
<el-input v-model="copyPartData.partNo" style="width: 140px"></el-input>
<el-input v-model="copyPartData.partDesc" style="width: 287px"></el-input>
</el-form-item>
</el-form>
</fieldset>
<fieldset style="width: 474px">
<legend>Select Part Information to Copy</legend>
<el-form :inline="true" style="margin-left: 7px">
<el-form-item label=" ">
<el-checkbox v-model="copyPartData.copyGeneral" true-label="Y">General</el-checkbox>
</el-form-item>
<!-- <el-form-item label=" ">-->
<!-- <el-checkbox v-model="copyPartData.copyCosts" true-label="Y">Costs</el-checkbox>-->
<!-- </el-form-item>-->
<!-- <el-form-item label=" ">-->
<!-- <el-checkbox v-model="copyPartData.copyPlanningData" true-label="Y">Planning Data</el-checkbox>-->
<!-- </el-form-item>-->
</el-form>
<!-- <el-form :inline="true" style="margin-left: 7px">-->
<!-- <el-form-item label=" ">-->
<!-- <el-checkbox v-model="copyPartData.copyManufacturing" true-label="Y">Manufacturing</el-checkbox>-->
<!-- </el-form-item>-->
<!-- <el-form-item label=" ">-->
<!-- <el-checkbox v-model="copyPartData.copyDefaultLocation" true-label="Y">Default Location</el-checkbox>-->
<!-- </el-form-item>-->
<!-- <el-form-item label=" ">-->
<!-- <el-checkbox v-model="copyPartData.copyRevision" true-label="Y">Revision</el-checkbox>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
</fieldset>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="copyPart">保存</el-button>
<el-button type="primary" @click="copyPartModelFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- chooseList模态框 -->
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<!-- 上传文件的modal -->
<partUploadFile ref="partUploadFile" @refreshPageTables="getFileContentData" v-drag></partUploadFile>
</div>
</template>
<script>
import {
partInformationSearch, // 物料信息列表查询
partInformationSave, // 物料信息新增
partInformationEdit, // 物料信息编辑
partInformationDelete, // 物料信息删除
getPartItem, // 查询物料属性
getAgentList, // 获取代理商列表
getPartAgent, // 获取物料代理商
getAgentListBy, // 根据条件查询可选代理商
addPartAgent, // 新增物料代理商
deletePartAgent, // 删除物料代理商
deleteAgent, // 删除物料代理商(单删)
getManufacturerList, // 获取制造商列表
getPartManufacturer, // 获取物料制造商
getManufacturerListBy, // 根据条件查询可选制造商
addPartManufacturer, // 新增物料制造商
deletePartManufacturer, // 删除物料制造商
deleteManufacturer, // 删除物料制造商(单删)
getLocationList, // 获取库位列表
getDefaultLocation, // 获取物料库位
getLocationListBy, // 根据条件查询可选库位
addDefaultLocation, // 新增物料库位
deleteDefaultLocation, // 删除物料库位
deleteLocation, // 删除物料库位(单删)
commitItemValue, // 修改物料属性值
getItemLists, // 获取模板属性
addPartItem, // 新增物料属性
deletePartItem, // 删除物料属性
queryPartItem,
copyPart, // 复制物料
getProjectPartNo, // 获取物料编码
verifyData, // 校验参数
getPreviousPartNo, // 获取上一个物料编码
} from '@/api/part/partInformation.js'
import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {deleteObjectFile} from '@/api/eam/eam.js'
import {getSiteAndBuByUserName, getSiteAndBuByUserName2} from "@/api/qc/qc.js"
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import partUploadFile from "./part_upload_file"
import {updateColumnSize} from "../../../api/table";
export default {
components: {
Chooselist,
partUploadFile
},
watch: {
searchData: {
deep: true,
handler: function (newV, oldV) {
this.searchData.partNo = this.searchData.partNo.toUpperCase()
}
},
modalData: {
deep: true,
handler: function (newV, oldV) {
this.modalData.partNo = this.modalData.partNo.toUpperCase()
}
},
itemData: {
deep: true,
handler: function (newV, oldV) {
this.itemData.propertiesItemNo = this.itemData.propertiesItemNo.toUpperCase()
}
},
agentData: {
deep: true,
handler: function (newV, oldV) {
this.agentData.agentId = this.agentData.agentId.toUpperCase()
}
},
manufacturerData: {
deep: true,
handler: function (newV, oldV) {
this.manufacturerData.manufacturerId = this.manufacturerData.manufacturerId.toUpperCase()
}
},
locationData: {
deep: true,
handler: function (newV, oldV) {
this.locationData.locationId = this.locationData.locationId.toUpperCase()
}
},
uploadDialog (newValue,oldValue) {
if (newValue === false) {
this.getFileContentData()
}
},
},
data () {
return {
// 导出
exportData: [],
exportName: '物料档案管理' + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ['物料档案管理'],
exportFooter: [],
resultList: [],
userBuList: [],
buList: [],
// ======== 行高 ========
height: 200,
secondHeight: 200,
// ======== 分页 ========
pageIndex: 1,
pageSize: 20,
totalPage: 0,
selectedDataNum: 0,
tempCodeNo: '',
// 条件查询
searchData: {
site: '',
userName: this.$store.state.user.name,
buNo: '',
partNo: '',
startDate: '',
endDate: '',
partDesc: '',
page: 1,
limit: 10
},
// 其它
loading: false,
// 初始页签
activeTable: 'part_item',
inventoryPartTable: 'General',
// ======== 数据对象 ========
modalData: {
flag: '',
title: '',
site: '',
buNo: '',
bu: '',
partNo: '',
partDesc: '',
umId2: '',
umName: '',
spec: '',
active: '',
partType2: '',
standardBoxQty: '',
productGroupId1: '',
productGroupName1: '',
productGroupId2: '',
productGroupName2: '',
productGroupId3: '',
productGroupName3: '',
familyID: '',
familyName: '',
partDesceEn: '',
remark: '',
codeNo: '',
codeDesc: '',
tblBaseFlag: ''
},
itemData: {
site: this.$store.state.user.site,
partNo: '',
propertiesItemNo: '',
codeNo: '',
itemDesc: '',
textValue: '',
numValue: '',
recordType: ''
},
agentData: {
site: '',
buNo: '',
agentId: '',
agentName: '',
},
manufacturerData: {
site: '',
buNo: '',
manufacturerId: '',
manufacturerName: '',
},
locationData: {
site: '',
buNo: '',
locationId: '',
locationName: '',
},
copyPartData: {
site: '',
partNo: '',
partDesc: '',
copyGeneral: 'Y',
copyCosts: '',
copyPlanningData: '',
copyManufacturing: '',
copyDefaultLocation: '',
copyRevision: '',
previousVersion: {},
createBy: ''
},
// ======== 数据列表 ========
dataList: [],
partItemList: [],
updatePartItemList: [],
partAgentList: [],
partManufacturerList: [],
defaultLocationList: [],
fileContentList: [],
availableValueList:[],
agentList: [],
agentSelections: [],
agentSelections1: [],
agentSelections2: [],
agentList1: [],
agentList2: [],
manufacturerList: [],
manufacturerSelections: [],
manufacturerSelections1: [],
manufacturerSelections2: [],
manufacturerList1: [],
manufacturerList2: [],
locationList: [],
locationSelections: [],
locationSelections1: [],
locationSelections2: [],
locationList1: [],
locationList2: [],
itemSelections1: [],
itemSelections2: [],
itemList1:[],
itemList2:[],
revisionList: [],
bomAlternativeList: [],
routingAlternativeList: [],
copyAttributeList: [],
fileList: [],
// ======== 列表表头 ========
columnList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1Bu',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'buDesc',
headerAlign: 'center',
align: 'center',
columnLabel: 'BU',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1PartNo',
tableId: '601001Table1',
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: 601001,
serialNumber: '601001Table1PartDesc',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'partDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '物料描述',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1PartDesceEn',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'partDesceEn',
headerAlign: 'center',
align: 'center',
columnLabel: '物料描述(英文)',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1Spec',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'spec',
headerAlign: 'center',
align: 'center',
columnLabel: '规格',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1ActiveDesc',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'activeDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在用',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1PartType2Desc',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'partType2Desc',
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: 601001,
serialNumber: '601001Table1UmId',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'umId2',
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: 601001,
serialNumber: '601001Table1UmName',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'umName',
headerAlign: 'center',
align: 'center',
columnLabel: '计量单位名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1FamilyID',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'familyID',
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: 601001,
serialNumber: '601001Table1FamilyName',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'familyName',
headerAlign: 'center',
align: 'center',
columnLabel: '物料分类名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroup1',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupId1',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组1编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroupName1',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupName1',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组1名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroup2',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupId2',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组2编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroupName2',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupName2',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组2名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroup3',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupId3',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组3编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1OtherGroupName3',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'productGroupName3',
headerAlign: 'center',
align: 'center',
columnLabel: '商品组3名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1CodeNo',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'codeNo',
headerAlign: 'center',
align: 'center',
columnLabel: '属性模板编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1CodeDesc',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'codeDesc',
headerAlign: 'center',
align: 'center',
columnLabel: '属性模板名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 200
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1Remark',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'remark',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 300
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1CreateDate',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table1CreateBy',
tableId: '601001Table1',
tableName: '物料信息表',
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
],
columnItemList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table2PropertiesItemID',
tableId: "601001Table2",
tableName: "物料属性表",
columnProp: 'propertiesItemNo',
headerAlign: "center",
align: "center",
columnLabel: '属性编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table2PropertiesItemDesc',
tableId: "601001Table2",
tableName: "物料属性表",
columnProp: 'itemDesc',
headerAlign: "center",
align: "center",
columnLabel: '属性名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 120,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table2ValueType',
tableId: "601001Table2",
tableName: "物料属性表",
columnProp: 'valueType',
headerAlign: "center",
align: "center",
columnLabel: '属性类型',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table2ValueChooseFlag',
tableId: "601001Table2",
tableName: "物料属性表",
columnProp: 'textValue',
headerAlign: "center",
align: "center",
columnLabel: '属性值',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 100,
},
// {
// userId: this.$store.state.user.name,
// functionId: 601001,
// serialNumber: '601001Table2ValueChooseFlag',
// tableId: "601001Table2",
// tableName: "物料属性表",
// columnProp: 'numValue',
// headerAlign: "center",
// align: "center",
// columnLabel: '数字值',
// columnHidden: false,
// columnImage: false,
// status: true,
// fixed: '',
// columnWidth: 70,
// },
],
updateColumnItemList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table6PropertiesItemID',
tableId: "601001Table6",
tableName: "物料属性表",
columnProp: 'propertiesItemNo',
headerAlign: "center",
align: "center",
columnLabel: '属性编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 90,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table6PropertiesItemDesc',
tableId: "601001Table6",
tableName: "物料属性表",
columnProp: 'itemDesc',
headerAlign: "center",
align: "center",
columnLabel: '属性名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 90,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table6ValueType',
tableId: "601001Table6",
tableName: "物料属性表",
columnProp: 'valueType',
headerAlign: "center",
align: "center",
columnLabel: '属性类型',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 70,
},
],
columnAgentList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3AgentId',
tableId: "601001Table3",
tableName: "物料代理商表",
columnProp: 'agentId',
headerAlign: "center",
align: "center",
columnLabel: '代理商编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3AgentName',
tableId: "601001Table3",
tableName: "物料代理商表",
columnProp: 'agentName',
headerAlign: "center",
align: "center",
columnLabel: '代理商名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3Active',
tableId: '601001Table3',
tableName: '物料代理商表',
columnProp: 'active',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在用',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3CreateDate',
tableId: '601001Table3',
tableName: '物料代理商表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3CreateBy',
tableId: '601001Table3',
tableName: '物料代理商表',
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3UpdateDate',
tableId: '601001Table3',
tableName: '物料代理商表',
columnProp: 'updateDate',
headerAlign: 'center',
align: 'center',
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table3UpdateBy',
tableId: '601001Table3',
tableName: '物料代理商表',
columnProp: 'updateBy',
headerAlign: 'center',
align: 'center',
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
}
],
columnManufacturerList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5ManufacturerId',
tableId: "601001Table5",
tableName: "物料制造商表",
columnProp: 'manufacturerId',
headerAlign: "center",
align: "center",
columnLabel: '制造商编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5ManufacturerName',
tableId: "601001Table5",
tableName: "物料制造商表",
columnProp: 'manufacturerName',
headerAlign: "center",
align: "center",
columnLabel: '制造商名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5Active',
tableId: '601001Table5',
tableName: '物料制造商表',
columnProp: 'active',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在用',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5CreateDate',
tableId: '601001Table5',
tableName: '物料制造商表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5CreateBy',
tableId: '601001Table5',
tableName: '物料制造商表',
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5UpdateDate',
tableId: '601001Table5',
tableName: '物料制造商表',
columnProp: 'updateDate',
headerAlign: 'center',
align: 'center',
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table5UpdateBy',
tableId: '601001Table5',
tableName: '物料制造商表',
columnProp: 'updateBy',
headerAlign: 'center',
align: 'center',
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
}
],
columnLocationList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7LocationId',
tableId: "601001Table7",
tableName: "物料库位表",
columnProp: 'locationId',
headerAlign: "center",
align: "center",
columnLabel: '库位编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7LocationName',
tableId: "601001Table7",
tableName: "物料库位表",
columnProp: 'locationName',
headerAlign: "center",
align: "center",
columnLabel: '库位名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7warehouseId',
tableId: "601001Table7",
tableName: "物料库位表",
columnProp: 'warehouseId',
headerAlign: "center",
align: "center",
columnLabel: '仓库编码',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7Active',
tableId: '601001Table7',
tableName: '物料库位表',
columnProp: 'active',
headerAlign: 'center',
align: 'center',
columnLabel: '是否在用',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7CreateDate',
tableId: '601001Table7',
tableName: '物料库位表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7CreateBy',
tableId: '601001Table7',
tableName: '物料库位表',
columnProp: 'createBy',
headerAlign: 'center',
align: 'center',
columnLabel: '创建人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7UpdateDate',
tableId: '601001Table7',
tableName: '物料库位表',
columnProp: 'updateDate',
headerAlign: 'center',
align: 'center',
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table7UpdateBy',
tableId: '601001Table7',
tableName: '物料库位表',
columnProp: 'updateBy',
headerAlign: 'center',
align: 'center',
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
}
],
columnFileList: [
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table4FileName',
tableId: '601001Table4',
tableName: '文件信息表',
columnProp: 'fileName',
headerAlign: 'center',
align: 'center',
columnLabel: '文件名称',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 200,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table4FileRemark',
tableId: '601001Table4',
tableName: '文件信息表',
columnProp: 'url',
headerAlign: 'center',
align: 'center',
columnLabel: '文件路径',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 300,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table4CreateDate',
tableId: '601001Table4',
tableName: '文件信息表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '上传时间',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 170,
},
{
userId: this.$store.state.user.name,
functionId: 601001,
serialNumber: '601001Table4CreatedBy',
tableId: '601001Table4',
tableName: '文件信息表',
columnProp: 'createdBy',
headerAlign: 'center',
align: 'center',
columnLabel: '上传人',
columnHidden: false,
columnImage: false,
status: true,
fixed: '',
columnWidth: 120,
}
],
// ======== 必填规则 ========
rules: {
bu: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
partNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
partDesc: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
umId2: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
codeNo: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
manufacturerName: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
active: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
agentName: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
partType2: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
productGroupId4: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
lotTrackingCode: [
{
required: true,
message: ' ',
trigger: ['blur','change']
}
],
},
// ======== 复选数据集 ========
partSelections: [],
bomAlternativeSelections: [],
routingAlternativeSelections: [],
// ======== 选中的当前行数据 ========
partCurrentRow: {},
// ======== 模态框开关控制 ========
authSearch: false,
authSave: false,
authUpdate: false,
authDelete: false,
modalFlag: false,
modalDisableFlag: false,
itemChooseFlag: false,
itemTextDisableFlag: false,
itemNumberDisableFlag: false,
itemModalDisableFlag: false,
itemModalFlag: false,
agentModelFlag: false,
manufacturerModelFlag: false,
updateItemModelFlag: false,
fastAddFlag: false,
locationModelFlag: false,
copyPartModelFlag: false,
attributeDialog: true,
uploadDialog: false,
menuId: this.$route.meta.menuId,
previousPartNo: ''
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight / 2 - 120
/*第二个表格高度的动态调整*/
this.secondHeight = window.innerHeight - this.height - 175
})
},
created () {
// 按钮控制
this.getButtonAuthData()
// 获取用户的 site 和 bu
this.getSiteAndBuByUserName()
// 获取用户的 site 和 bu
this.getSiteAndBuByUserName2()
// 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
if (!this.authSearch) {
// 获取数据列表
this.getDataList()
}
},
methods: {
handleColumnResize(newWidth, oldWidth, column, event){
let inData= this.columnList.filter(item => item.columnProp === column.property)[0]
inData.columnWidth=newWidth
updateColumnSize(inData).then(({data}) => {
if (data.code === 0) {
console.log("栏位宽度保存成功!")
}
})
},
// 获取用户的bu
getSiteAndBuByUserName2 () {
let tempData = {
username: this.$store.state.user.name,
}
getSiteAndBuByUserName2(tempData).then(({data}) => {
if (data.code === 0) {
this.buList = data.rows
}
})
},
// 获取用户的bu
getSiteAndBuByUserName () {
let tempData = {
username: this.$store.state.user.name,
}
getSiteAndBuByUserName(tempData).then(({data}) => {
if (data.code === 0) {
this.userBuList = data.rows
}
})
},
// 页签选择替换
inventoryPartClick (tab, event) {
this.refreshInventoryPartTable()
},
// 刷新页签的table数据
refreshInventoryPartTable () {
},
clickSave () {
if (!this.attributeDialog) { // 保存
this.updateItemValue()
} else { // 编辑
this.copyAttributeList = JSON.parse(JSON.stringify(this.partItemList))
this.attributeDialog = false
}
},
/**
* 编辑物料属性
*/
updateItemValue () {
this.loading = true
let tempData = {
itemList: JSON.parse(JSON.stringify(this.copyAttributeList))
}
commitItemValue(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getPartItem()
this.attributeDialog = true
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.loading = false
}).catch((error) => {
this.$message.error(error)
this.loading = false
})
},
/**
* 新增/删除物料属性
*/
addOrDelItem () {
if (!this.attributeDialog) {
this.$message.warning('请保存属性更改!')
return
}
this.itemSelections1 = null
this.itemSelections2 = null
this.itemData.propertiesItemNo = ''
this.itemData.itemDesc = ''
let tempData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
recordType: 'IP'
}
getItemLists(tempData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.fastAddFlag = true
},
// 可选属性
itemClickRow1 (row) {
this.$refs.itemTable1.toggleRowSelection(row)
},
// 已有属性
itemClickRow2 (row) {
this.$refs.itemTable2.toggleRowSelection(row)
},
selectionItem1 (val) {
this.itemSelections1 = val
},
selectionItem2 (val) {
this.itemSelections2 = val
},
// 物料项目新增
addItem () {
if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
this.$message.warning('请选择可选属性!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
codeDesc: this.partCurrentRow.codeDesc,
recordType: 'IP',
itemList: this.itemSelections1
}
addPartItem(inData).then(({data}) => {
if (data && data.code === 0) {
getItemLists(inData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.getPartItem()
this.itemSelections1 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 物料项目删除
deleteItem () {
if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
this.$alert("请选择已有属性!", '提示', {
confirmButtonText: '确定'
})
return false
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
codeDesc: this.partCurrentRow.codeDesc,
recordType: 'IP',
itemList: this.itemSelections2
}
deletePartItem(inData).then(({data}) => {
if (data && data.code === 0) {
getItemLists(inData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.getPartItem()
this.itemSelections2 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 查询物料项目
queryPartItem () {
this.itemData.partNo = this.partCurrentRow.partNo
this.itemData.codeNo = this.partCurrentRow.codeNo
this.itemData.partNo = this.partCurrentRow.partNo
queryPartItem(this.itemData).then(({data}) => {
if (data && data.code === 0) {
this.itemList1 = data.rows
} else {
this.itemList1 = []
}
})
},
// 确认修改物料属性
commitItemValue () {
let tempData = {
itemList: JSON.parse(JSON.stringify(this.updatePartItemList))
}
commitItemValue(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getPartItem()
this.updateItemModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// ======= 正则校验 =======
handleInput (value, type) {
// 大于等于0,且只能输入4位小数
let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
if (val === null || val === undefined || val === '') {
val = 0
}
if (type === 1) {
}
},
// ======== 分页相关方法 ========
/**
* 每页数
* @param val
*/
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
/**
* 当前页
* @param val
*/
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// ======== 页签切换相关方法 ========
/**
* 列表表格选择替换
* @param tab
* @param event
*/
tabClick (tab, event) {
// 刷新列表数据
this.refreshCurrentTabTable()
},
/**
* 当前值发生变化的时候修改
* @param row
* @param oldRow
*/
changeCurrentRow (row, oldRow) {
// 判断是否是获取焦点的事件
if (row) {
this.partCurrentRow = JSON.parse(JSON.stringify(row))
//刷新当前页表
this.refreshCurrentTabTable()
}
},
/**
* 刷新页签的table数据
*/
refreshCurrentTabTable () {
if (this.activeTable === 'part_item') {
this.getPartItem()
} else if (this.activeTable === 'part_agent') {
this.getPartAgent()
} else if (this.activeTable === 'part_file') {
this.getFileContentData()
} else if (this.activeTable === 'part_manufacturer') {
this.getPartManufacturer()
} else if (this.activeTable === 'default_locations') {
this.getDefaultLocation()
}
},
// ======== 列表数据刷新方法 ========
/**
* 查询物料属性
*/
getPartItem () {
let tempData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
recordType: 'IP'
}
getPartItem(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partItemList = data.rows
} else {
this.partItemList = []
}
})
},
/**
* 查询物料代理商
*/
getPartAgent () {
let tempData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
}
getPartAgent(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partAgentList = data.rows
} else {
this.partAgentList = []
}
})
},
/**
* 查询物料制造商
*/
getPartManufacturer () {
let tempData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
}
getPartManufacturer(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partManufacturerList = data.rows
} else {
this.partManufacturerList = []
}
})
},
/**
* 查询物料库位
*/
getDefaultLocation () {
let tempData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
}
getDefaultLocation(tempData).then(({data}) => {
if (data && data.code === 0) {
this.defaultLocationList = data.rows
} else {
this.defaultLocationList = []
}
})
},
// ======== 列表数据刷新方法 ========
/**
* 获取数据列表
*/
getDataList () {
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
partInformationSearch(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
this.$refs.selectDiv.setLengthAll(this.dataList.length)
// 判断是否全部存在数据
if (this.dataList.length > 0) {
// 设置选中行
this.$refs.partTable.setCurrentRow(this.dataList[0])
this.partClickRow(this.dataList[0])
} else {
this.partCurrentRow = {}
}
// 加载当前的页签的table
//this.refreshCurrentTabTable()
}
})
},
// ======== 新增/编辑模态框 ========
/**
* 物料信息新增模态框
*/
addModal () {
this.modalData = {
flag: '1',
title: '物料新增',
site: '',
buNo: '',
bu: this.userBuList[0].buNo,
partNo: '',
partDesc: '',
umId2: '',
umName: '',
spec: '',
active: 'Y',
partType2: 'Purchased (raw)',
standardBoxQty: '',
productGroupId1: '',
productGroupName1: '',
productGroupId2: '',
productGroupName2: '',
productGroupId3: '',
productGroupName3: '',
familyID: '',
familyName: '',
partDesceEn: '',
remark: '',
codeNo: '',
codeDesc: '',
tblBaseFlag: '',
createBy: this.$store.state.user.name
}
this.inventoryPartTable = 'General'
this.modalDisableFlag = false
this.modalFlag = true
this.getPreviousPartNo()
},
// 获取上一个物料编码
getPreviousPartNo () {
let tempData = {
site: this.modalData.bu.split('_')[0],
type: 'thePreviousPartItem',
thirdType: this.modalData.bu.split('_')[1],
secondType: this.$store.state.user.name
}
getPreviousPartNo(tempData).then(({data}) => {
if (data && data.code === 0) {
this.previousPartNo = data.previousPartNo
} else {
this.previousPartNo = ''
}
})
},
/**
* 物料信息编辑模态框
* @param row
*/
updateModal (row) {
this.modalData = {
flag: '2',
title: '物料编辑',
bu: row.site + '_' + row.buNo,
site: row.site,
buNo: row.buNo,
partNo: row.partNo,
partDesc: row.partDesc,
umId2: row.umId2,
umName: row.umName,
spec: row.spec,
active: row.active,
partType2: row.partType2,
standardBoxQty: row.standardBoxQty,
productGroupId1: row.productGroupId1,
productGroupName1: row.productGroupName1,
productGroupId2: row.productGroupId2,
productGroupName2: row.productGroupName2,
productGroupId3: row.productGroupId3,
productGroupName3: row.productGroupName3,
familyID: row.familyID,
familyName: row.familyName,
partDesceEn: row.partDesceEn,
remark: row.remark,
codeNo: row.codeNo,
codeDesc: row.codeDesc,
tblBaseFlag: '',
createBy: ''
}
this.inventoryPartTable = 'General'
this.modalDisableFlag = true
this.modalFlag = true
},
/**
* 选择代理商
*/
getAgentList () {
// 查询所有代理商
getAgentListBy(this.agentData).then(({data}) => {
if (data && data.code === 0) {
this.agentList1 = data.rows
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
savePartAgent () {
this.agentSelections1 = null
this.agentSelections2 = null
getAgentList(this.partCurrentRow).then(({data}) => {
this.agentList1 = data.row1
this.agentList2 = data.row2
})
this.agentData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
agentId: '',
agentName: '',
}
this.agentModelFlag = true
},
// 可选代理商
agentClickRow1 (row) {
this.$refs.agentTable1.toggleRowSelection(row)
},
// 已有代理商
agentClickRow2 (row) {
this.$refs.agentTable2.toggleRowSelection(row)
},
selectionAgent1 (val) {
this.agentSelections1 = val
},
selectionAgent2 (val) {
this.agentSelections2 = val
},
// 添加代理商
addAgent () {
if (this.agentSelections1 == null || this.agentSelections1.length === 0) {
this.$message.warning('请选择可选代理商!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
agentList: this.agentSelections1
}
addPartAgent(inData).then(({data}) => {
if (data && data.code === 0) {
getAgentList(this.partCurrentRow).then(({data}) => {
this.agentList1 = data.row1
this.agentList2 = data.row2
})
this.agentSelections1 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 删除物料代理商
deleteAgent () {
if(this.agentSelections2 == null || this.agentSelections2.length === 0){
this.$message.warning('请选择已有代理商!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
agentList: this.agentSelections2
}
deletePartAgent(inData).then(({data}) => {
if (data && data.code === 0) {
getAgentList(this.partCurrentRow).then(({data}) => {
this.agentList1 = data.row1
this.agentList2 = data.row2
})
this.agentSelections2 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 单删
deleteAgent2 (row) {
this.$confirm(`是否删除该代理商?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteAgent(row).then(({data}) => {
if (data && data.code === 0) {
this.getPartAgent()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
/**
* 选择制造商
*/
getManufacturerList () {
// 查询所有代理商
getManufacturerListBy(this.manufacturerData).then(({data}) => {
if (data && data.code === 0) {
this.manufacturerList1 = data.rows
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
/**
* 选择默认库位
*/
getLocationList () {
// 查询所有库位
getLocationListBy(this.locationData).then(({data}) => {
if (data && data.code === 0) {
this.locationList1 = data.rows
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
savePartManufacturer () {
this.manufacturerSelections1 = null
this.manufacturerSelections2 = null
getManufacturerList(this.partCurrentRow).then(({data}) => {
this.manufacturerList1 = data.row1
this.manufacturerList2 = data.row2
})
this.manufacturerData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
manufacturerId: '',
manufacturerName: '',
}
this.manufacturerModelFlag = true
},
// 可选制造商
manufacturerClickRow1 (row) {
this.$refs.manufacturerTable1.toggleRowSelection(row)
},
// 已有制造商
manufacturerClickRow2 (row) {
this.$refs.manufacturerTable2.toggleRowSelection(row)
},
selectionManufacturer1 (val) {
this.manufacturerSelections1 = val
},
selectionManufacturer2 (val) {
this.manufacturerSelections2 = val
},
// 添加制造商
addManufacturer () {
if (this.manufacturerSelections1 == null || this.manufacturerSelections1.length === 0) {
this.$message.warning('请选择可选制造商!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
manufacturerList: this.manufacturerSelections1
}
addPartManufacturer(inData).then(({data}) => {
if (data && data.code === 0) {
getManufacturerList(this.partCurrentRow).then(({data}) => {
this.manufacturerList1 = data.row1
this.manufacturerList2 = data.row2
})
this.manufacturerSelections1 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 删除物料制造商
deleteManufacturer () {
if (this.manufacturerSelections2 == null || this.manufacturerSelections2.length === 0) {
this.$message.warning('请选择已有制造商!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
manufacturerList: this.manufacturerSelections2
}
deletePartManufacturer(inData).then(({data}) => {
if (data && data.code === 0) {
getManufacturerList(this.partCurrentRow).then(({data}) => {
this.manufacturerList1 = data.row1
this.manufacturerList2 = data.row2
})
this.manufacturerSelections2 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 单删
deleteManufacturer2 (row) {
this.$confirm(`是否删除该制造商?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteManufacturer(row).then(({data}) => {
if (data && data.code === 0) {
this.getPartManufacturer()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
saveDefaultLocation () {
this.locationSelections1 = null
this.locationSelections2 = null
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
this.locationList2 = data.row2
})
this.locationData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
locationId: '',
locationName: '',
}
this.locationModelFlag = true
},
// 可选库位
locationClickRow1 (row) {
this.$refs.locationTable1.toggleRowSelection(row)
},
// 已有库位
locationClickRow2 (row) {
this.$refs.locationTable2.toggleRowSelection(row)
},
selectionLocation1 (val) {
this.locationSelections1 = val
},
selectionLocation2 (val) {
this.locationSelections2 = val
},
// 添加库位
addLocation () {
if (this.locationSelections1 == null || this.locationSelections1.length === 0) {
this.$message.warning('请选择可选库位!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
locationList: this.locationSelections1
}
addDefaultLocation(inData).then(({data}) => {
if (data && data.code === 0) {
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
this.locationList2 = data.row2
})
this.locationSelections1 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 删除库位
deleteLocation () {
if (this.locationSelections2 == null || this.locationSelections2.length === 0) {
this.$message.warning('请选择已有库位!')
return
}
let inData = {
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
partNo: this.partCurrentRow.partNo,
locationList: this.locationSelections2
}
deleteDefaultLocation(inData).then(({data}) => {
if (data && data.code === 0) {
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
this.locationList2 = data.row2
})
this.locationSelections2 = []
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 单删
deleteLocation2 (row) {
this.$confirm(`是否删除该库位?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteLocation(row).then(({data}) => {
if (data && data.code === 0) {
this.getDefaultLocation()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
// 关闭后刷新列表
refreshDetailList () {
this.getPartAgent()
this.getPartManufacturer()
this.getDefaultLocation()
},
// ======== 新增/编辑/删除方法 ========
/**
* 物料信息新增/编辑
*/
saveData () {
if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
this.$message.warning('请填写物料描述!')
return
}
if (this.modalData.bu === '' || this.modalData.bu == null) {
this.$message.warning('请选择BU!')
return
}
if (this.modalData.umId2 === '' || this.modalData.umId2 == null) {
this.$message.warning('请选择计量单位!')
return
}
if (this.modalData.tblBaseFlag === 'Y' && this.modalData.codeNo === '') {
this.$message.warning('请选择属性模板!')
return
}
if (this.modalData.flag === '1') {
partInformationSave(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.searchData.partNo = data.partNo
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
} else {
partInformationEdit(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: '确定'
})
}
})
}
},
/**
* 物料信息删除
*/
delModal () {
if (this.partSelections.length === 0) {
this.$message.warning('请勾选要删除的物料信息!')
return
}
this.$confirm(`是否删除这 `+ this.partSelections.length +` 条物料信息?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
informationList: this.partSelections
}
partInformationDelete(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.partSelections = []
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
// 复制物料的模态框
toCopyPartModal () {
this.copyPartData = {
site: this.modalData.site,
buNo: this.modalData.buNo,
partNo: this.modalData.partNo,
partDesc: this.modalData.partDesc,
copyGeneral: 'Y',
copyCosts: '',
copyPlanningData: '',
copyManufacturing: '',
copyDefaultLocation: '',
copyRevision: '',
previousVersion: this.modalData,
createBy: this.$store.state.user.name
}
this.copyPartModelFlag = true
},
// 复制物料的方法
copyPart () {
if (this.copyPartData.partNo === '' || this.copyPartData.partNo == null) {
this.$message.warning('请输入物料编码!')
return
}
if (this.copyPartData.partDesc === '' || this.copyPartData.partDesc == null) {
this.$message.warning('请输入物料名称!')
return
}
if (this.copyPartData.copyGeneral === '' || this.copyPartData.copyGeneral == null) {
this.$message.warning('General信息必选!')
return
}
copyPart(this.copyPartData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.copyPartModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// ======== 列表操作方法 ========
/**
* 单机选中物料信息
* @param row
*/
partClickRow (row,column) {
this.partCurrentRow = JSON.parse(JSON.stringify(row))
},
/**
* 复选物料信息
* @param val
*/
selectionPart (val) {
this.partSelections = val
this.$refs.selectDiv.setLengthselected(this.partSelections.length)
},
// ======== 附件的相关方法 ========
/**
* 获取物料附件列表
*/
getFileContentData () {
let currentData = {
orderRef1: this.partCurrentRow.site,
orderRef2: this.partCurrentRow.partNo,
orderRef3: 'part',
orderRef4: this.partCurrentRow.buNo,
}
getFileContentList(currentData).then(({data}) => {
if (data && data.code === 200) {
this.fileContentList = data.rows
} else {
this.fileContentList = []
}
})
},
/**
* 上传文件
*/
uploadFile () {
let currentData = {
titleCon: '物料附件上传',
site: this.partCurrentRow.site,
buNo: this.partCurrentRow.buNo,
createBy: this.$store.state.user.name,
partNo: this.partCurrentRow.partNo,
folder: 'part'
}
this.uploadDialog = true
// 打开组件去做新增业务
this.$nextTick(() => {
this.$refs.partUploadFile.init(currentData);
})
},
/**
* 文件删除
* @param row
*/
deleteFile (row) {
this.$confirm('确定要删除此文件?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteObjectFile(row).then(({data}) => {
if (data && data.code === 0) {
this.getFileContentData()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
/**
* 文件下载
* @param row
*/
downloadFile (row) {
downLoadObjectFile(row).then(({data}) => {
// 不限制文件下载类型
const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
// 下载文件名称
const fileName = row.fileName
// a标签下载
const linkNode = document.createElement('a')
linkNode.download = fileName // a标签的download属性规定下载文件的名称
linkNode.style.display = 'none'
linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
document.body.appendChild(linkNode)
linkNode.click() // 模拟在按钮上的一次鼠标单击
URL.revokeObjectURL(linkNode.href) // 释放URL 对象
document.body.removeChild(linkNode)
})
},
// 预览
previewFile (row) {
// 预览文件
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
let type = ''
if (image.includes(row.fileType.toLowerCase())) {
type = 'image/' + row.fileType
}
let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
if (video.includes(row.fileType.toLowerCase())) {
type = 'video/' + row.fileType
}
let txt = ['txt']
if (txt.includes(row.fileType.toLowerCase())) {
type = 'text/plain'
}
let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
if (office.includes(row.fileType.toLowerCase())) {
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
return
}
let pdf = ['pdf']
if (pdf.includes(row.fileType.toLowerCase())) {
type = 'application/pdf'
}
if (type === ''){
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
return;
}
downLoadObjectFile(row).then(({data}) => {
const blob = new Blob([data], { type: type });
// 创建URL来生成预览
const fileURL = URL.createObjectURL(blob);
// 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank')
})
},
// 计量单位输入校验
umIdBlur (tagNo) {
if (this.modalData.umId2 != null && this.modalData.umId2 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and UMID = '" + this.modalData.umId2 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.umId2 = data.baseListData[0].UMID
this.modalData.umName = data.baseListData[0].UMName
return
}
}
})
}
this.modalData.umName = ''
},
// 商品组1输入校验
productGroupId1Blur (tagNo) {
if (this.modalData.productGroupId1 != null && this.modalData.productGroupId1 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.productGroupId1 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.productGroupId1 = data.baseListData[0].product_group_id
this.modalData.productGroupName1 = data.baseListData[0].product_group_name
return
}
}
})
}
this.modalData.productGroupName1 = ''
},
// 商品组2输入校验
productGroupId2Blur (tagNo) {
if (this.modalData.productGroupId2 != null && this.modalData.productGroupId2 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.productGroupId2 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.productGroupId2 = data.baseListData[0].product_group_id
this.modalData.productGroupName2 = data.baseListData[0].product_group_name
return
}
}
})
}
this.modalData.productGroupName2 = ''
},
// 商品组3输入校验
productGroupId3Blur (tagNo) {
if (this.modalData.productGroupId3 != null && this.modalData.productGroupId3 !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and product_group_id = '" + this.modalData.productGroupId3 + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.productGroupId3 = data.baseListData[0].product_group_id
this.modalData.productGroupName3 = data.baseListData[0].product_group_name
return
}
}
})
}
this.modalData.productGroupName3 = ''
},
// 物料分类输入校验
partFamilyBlur (tagNo) {
if (this.modalData.familyID != null && this.modalData.familyID !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and family_id = '" + this.modalData.familyID + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.familyID = data.baseListData[0].family_id
this.modalData.familyName = data.baseListData[0].family_name
return
}
}
})
}
this.modalData.familyName = ''
},
// 属性输入校验
modelBlur (tagNo) {
if (this.modalData.codeNo != null && this.modalData.codeNo !== '') {
let tempData = {
tagno: tagNo,
conditionSql: " and code_no = '" + this.modalData.codeNo + "'" + " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
verifyData(tempData).then(({data}) => {
if (data && data.code === 0) {
if (data.baseListData.length > 0) {
this.modalData.codeNo = data.baseListData[0].code_no
this.modalData.codeDesc = data.baseListData[0].code_desc
return
}
}
})
}
this.modalData.codeDesc = ''
},
// ======== chooseList相关方法 ========
/**
* 获取基础数据列表S
* @param val
* @param type
*/
getBaseList (val, type) {
this.tagNo = val
this.tempCodeNo = this.modalData.codeNo
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (this.modalData.bu === null || this.modalData.bu === '') {
this.$message.warning("请选择BU!")
return
} else {
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'" + " and bu_no = '" + this.modalData.bu.split('_')[1] + "'"
}
if (val === 510) {
strVal = this.modalData.umId2
conSql = " and site = '" + this.modalData.bu.split('_')[0] + "'"
} else if (val === 211) {
strVal = this.modalData.productGroupId1
} else if (val === 212) {
strVal = this.modalData.productGroupId2
} else if (val === 213) {
strVal = this.modalData.productGroupId3
} else if (val === 214) {
strVal = this.modalData.familyID
} else if (val === 219) {
strVal = this.modalData.codeNo
}
this.$refs.baseList.init(val, strVal, conSql)
})
},
/**
* 列表方法的回调
* @param val
*/
getBaseData (val) {
if (this.tagNo === 510) {
this.modalData.umId2 = val.UMID
this.modalData.umName = val.UMName
} else if (this.tagNo === 211) {
this.modalData.productGroupId1 = val.product_group_id
this.modalData.productGroupName1 = val.product_group_name
} else if (this.tagNo === 212) {
this.modalData.productGroupId2 = val.product_group_id
this.modalData.productGroupName2 = val.product_group_name
} else if (this.tagNo === 213) {
this.modalData.productGroupId3 = val.product_group_id
this.modalData.productGroupName3 = val.product_group_name
} else if (this.tagNo === 214) {
this.modalData.familyID = val.family_id
this.modalData.familyName = val.family_name
} else if (this.tagNo === 219) {
if (this.modalData.flag === '2') {
if (val.code_no != this.tempCodeNo) {
this.$confirm(`更换属性模板将替换下方物料属性数据,请确认?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
}).catch(() => {
})
}
} else {
this.modalData.codeNo = val.code_no
this.$set(this.modalData, 'codeDesc', val.code_desc)
}
}
},
// ======== 导出相关方法 ========
/**
* 导出excel
*/
async createExportData () {
this.searchData.limit = -1
this.searchData.page = 1
await partInformationSearch(this.searchData).then(({data}) => {
this.resultList = data.page.list
})
return this.resultList
},
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
},
toMenu (type,row) {
let path = '';
if (type === 'Routing'){
path = 'routing'
}else if (type === 'BOM'){
path = 'bom'
}
this.$router.push({name:`part-${path}Management`,params:{partNo:row.partNo},})
},
rowStyle ({row}) {
if (this.partCurrentRow.partNo === row.partNo) {
return { 'background-color': '#E8F7F6', cursor: 'pointer' };
}
},
// 动态列开始 获取 用户保存的 格式列
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) {
switch (columnId) {
case 1:
this.columnList = 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;
}
}
})
},
//获取按钮的权限数据
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")
//处理页面的权限数据
this.authSearch = !searchFlag
this.authSave = !saveFlag
this.authUpdate = !updateFlag
this.authDelete = !deleteFlag
},
}
}
</script>
<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
padding: 0px !important;
}
///deep/ .customer-tab .el-tabs__content {
//
//}
.el-table /deep/ .cell{
height: auto;
line-height: 1.5;
}
</style>