|
|
@ -8,12 +8,24 @@ |
|
|
<!-- <span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">产品编码</a></span> --> |
|
|
<!-- <span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">产品编码</a></span> --> |
|
|
<el-input v-model="searchData.partNo" style="width: 130px"></el-input> |
|
|
<el-input v-model="searchData.partNo" style="width: 130px"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item :label="'NPC货号:'"> |
|
|
|
|
|
<el-input v-model="searchData.npc" style="width: 130px"></el-input> |
|
|
|
|
|
|
|
|
<el-form-item :label="'基准料号:'"> |
|
|
|
|
|
<el-input v-model="searchData.basePartNo" style="width: 130px"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<!-- <el-form-item :label="'NPC货号:'">--> |
|
|
|
|
|
<!-- <el-input v-model="searchData.npc" style="width: 130px"></el-input>--> |
|
|
|
|
|
<!-- </el-form-item>--> |
|
|
<el-form-item :label="'产品名称:'"> |
|
|
<el-form-item :label="'产品名称:'"> |
|
|
<el-input v-model="searchData.partDesc" style="width: 130px"></el-input> |
|
|
<el-input v-model="searchData.partDesc" style="width: 130px"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="'Item:'"> |
|
|
|
|
|
<el-input v-model="searchData.item" style="width: 130px"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="'SKU:'"> |
|
|
|
|
|
<el-input v-model="searchData.sku" style="width: 130px"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item :label="'默认供应商:'"> |
|
|
|
|
|
<el-input v-model="searchData.defaultSupplierNo" style="width: 130px"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
<el-form-item :label="'一级分类:'"> |
|
|
<el-form-item :label="'一级分类:'"> |
|
|
<el-select v-model="searchData.category" clearable filterable style="width: 130px" @change="onSearchCategoryChange"> |
|
|
<el-select v-model="searchData.category" clearable filterable style="width: 130px" @change="onSearchCategoryChange"> |
|
|
<el-option v-for="item in searchCategoryLevel1Options" :key="item.familyId" |
|
|
<el-option v-for="item in searchCategoryLevel1Options" :key="item.familyId" |
|
|
@ -37,6 +49,7 @@ |
|
|
<el-form-item :label="' '"> |
|
|
<el-form-item :label="' '"> |
|
|
<el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button> |
|
|
<el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button> |
|
|
<el-button @click="addPart()" type="primary" style="margin-left: 2px">新增</el-button> |
|
|
<el-button @click="addPart()" type="primary" style="margin-left: 2px">新增</el-button> |
|
|
|
|
|
<el-button @click="openCopyDialog" type="primary" style="margin-left: 2px">复制</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
@ -127,19 +140,47 @@ |
|
|
<div class="form-section"> |
|
|
<div class="form-section"> |
|
|
<el-row :gutter="24"> |
|
|
<el-row :gutter="24"> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-form-item label="产品编码" prop="partNo"> |
|
|
|
|
|
<el-input v-model="currentpart.partNo" :disabled="!isAdd"></el-input> |
|
|
|
|
|
|
|
|
<el-form-item label="基准料号" prop="basePartNo"> |
|
|
|
|
|
<el-input v-model="currentpart.basePartNo" :disabled="!isAdd" @input="syncGeneratedPartNo"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-form-item label="NPC货号" prop="npc"> |
|
|
|
|
|
<el-input v-model="currentpart.npc"></el-input> |
|
|
|
|
|
|
|
|
<el-form-item label="物料后缀" prop="partSuffix"> |
|
|
|
|
|
<el-input v-model="currentpart.partSuffix" :disabled="!isAdd" @input="syncGeneratedPartNo"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-form-item label="产品编码" prop="partNo"> |
|
|
|
|
|
<el-input v-model="currentpart.partNo" disabled></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
<!-- <el-col :span="6">--> |
|
|
|
|
|
<!-- <el-form-item label="NPC货号" prop="npc">--> |
|
|
|
|
|
<!-- <el-input v-model="currentpart.npc"></el-input>--> |
|
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
|
<!-- </el-col>--> |
|
|
|
|
|
</el-row> |
|
|
|
|
|
<el-row :gutter="24"> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-form-item> |
|
|
<el-form-item> |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a href="#">计量单位</a></span> |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(510)"><a href="#">计量单位</a></span> |
|
|
<el-input v-model="currentpart.unit" style="width: 130px"></el-input> |
|
|
|
|
|
|
|
|
<el-input v-model="currentpart.unit" ></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-form-item prop="defaultSupplierNo"> |
|
|
|
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(501)"><a href="#">默认供应商</a></span> |
|
|
|
|
|
<el-input v-model="currentpart.defaultSupplierNo" ></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-form-item label="Item"> |
|
|
|
|
|
<el-input v-model="currentpart.item"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="6"> |
|
|
|
|
|
<el-form-item label="SKU"> |
|
|
|
|
|
<el-input v-model="currentpart.sku"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
@ -190,13 +231,13 @@ |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-form-item > |
|
|
<el-form-item > |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(529)"><a href="#">采购员</a></span> |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(529)"><a href="#">采购员</a></span> |
|
|
<el-input v-model="currentpart.buyerName" style="width: 130px"></el-input> |
|
|
|
|
|
|
|
|
<el-input v-model="currentpart.buyerName" ></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-form-item > |
|
|
<el-form-item > |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(528)"><a href="#">sourcing专员</a></span> |
|
|
<span style="cursor: pointer" slot="label" @click="getBaseList(528)"><a href="#">sourcing专员</a></span> |
|
|
<el-input v-model="currentpart.sourcingName" style="width: 130px"></el-input> |
|
|
|
|
|
|
|
|
<el-input v-model="currentpart.sourcingName" ></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
@ -233,6 +274,21 @@ |
|
|
</div> |
|
|
</div> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="复制物料" :visible.sync="copyDialogVisible" width="420px" :close-on-click-modal="false"> |
|
|
|
|
|
<el-form :model="copyForm" :rules="copyRules" ref="copyForm" label-width="100px"> |
|
|
|
|
|
<el-form-item label="基准料号" prop="basePartNo"> |
|
|
|
|
|
<el-input v-model="copyForm.basePartNo"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="物料后缀" prop="partSuffix"> |
|
|
|
|
|
<el-input v-model="copyForm.partSuffix"></el-input> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button type="primary" @click="confirmCopyPart">确认</el-button> |
|
|
|
|
|
<el-button @click="copyDialogVisible = false">取消</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
<!-- 审批对话框 - rqrq --> |
|
|
<!-- 审批对话框 - rqrq --> |
|
|
<!-- <el-dialog |
|
|
<!-- <el-dialog |
|
|
title="审批" |
|
|
title="审批" |
|
|
@ -271,6 +327,7 @@ import { |
|
|
searchPartList, |
|
|
searchPartList, |
|
|
createPart, |
|
|
createPart, |
|
|
updatePart, |
|
|
updatePart, |
|
|
|
|
|
copyPartByBase, |
|
|
deletePart |
|
|
deletePart |
|
|
} from '@/api/part/partInfo.js' |
|
|
} from '@/api/part/partInfo.js' |
|
|
import excel from '@/utils/excel-util.js' |
|
|
import excel from '@/utils/excel-util.js' |
|
|
@ -286,6 +343,7 @@ import { |
|
|
restartFlowInstance |
|
|
restartFlowInstance |
|
|
} from '@/api/workFlow/workFlow.js' |
|
|
} from '@/api/workFlow/workFlow.js' |
|
|
import { listPartFamilyByType } from '@/api/baseInformation/srmPartFamily.js' |
|
|
import { listPartFamilyByType } from '@/api/baseInformation/srmPartFamily.js' |
|
|
|
|
|
import { refreshPropertiesModal as refreshPartPropertiesModal } from '@/api/part/partProperties.js' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
watch: { |
|
|
watch: { |
|
|
@ -301,6 +359,10 @@ export default { |
|
|
this.searchData.codeNo = this.searchData.codeNo.toUpperCase() |
|
|
this.searchData.codeNo = this.searchData.codeNo.toUpperCase() |
|
|
this.searchData.partDesc = this.searchData.partDesc.toUpperCase() |
|
|
this.searchData.partDesc = this.searchData.partDesc.toUpperCase() |
|
|
this.searchData.partSpec = this.searchData.partSpec.toUpperCase() |
|
|
this.searchData.partSpec = this.searchData.partSpec.toUpperCase() |
|
|
|
|
|
this.searchData.basePartNo = (this.searchData.basePartNo || '').toUpperCase() |
|
|
|
|
|
this.searchData.sku = (this.searchData.sku || '').toUpperCase() |
|
|
|
|
|
this.searchData.item = (this.searchData.item || '').toUpperCase() |
|
|
|
|
|
this.searchData.defaultSupplierNo = (this.searchData.defaultSupplierNo || '').toUpperCase() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
currentpart: { |
|
|
currentpart: { |
|
|
@ -315,6 +377,14 @@ export default { |
|
|
this.currentpart.codeNo = this.currentpart.codeNo.toUpperCase() |
|
|
this.currentpart.codeNo = this.currentpart.codeNo.toUpperCase() |
|
|
this.currentpart.partDesc = this.currentpart.partDesc.toUpperCase() |
|
|
this.currentpart.partDesc = this.currentpart.partDesc.toUpperCase() |
|
|
this.currentpart.partSpec = this.currentpart.partSpec.toUpperCase() |
|
|
this.currentpart.partSpec = this.currentpart.partSpec.toUpperCase() |
|
|
|
|
|
this.currentpart.basePartNo = (this.currentpart.basePartNo || '').toUpperCase() |
|
|
|
|
|
this.currentpart.partSuffix = (this.currentpart.partSuffix || '').toUpperCase() |
|
|
|
|
|
this.currentpart.sku = (this.currentpart.sku || '').toUpperCase() |
|
|
|
|
|
this.currentpart.item = (this.currentpart.item || '').toUpperCase() |
|
|
|
|
|
this.currentpart.defaultSupplierNo = (this.currentpart.defaultSupplierNo || '').toUpperCase() |
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
this.currentpart.partNo = this.generatePartNo(this.currentpart.basePartNo, this.currentpart.partSuffix) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -325,9 +395,13 @@ export default { |
|
|
currentRow: {}, |
|
|
currentRow: {}, |
|
|
searchData: { |
|
|
searchData: { |
|
|
partNo: '', |
|
|
partNo: '', |
|
|
|
|
|
basePartNo: '', |
|
|
npc: '', |
|
|
npc: '', |
|
|
partDesc: '', |
|
|
partDesc: '', |
|
|
partSpec: '', |
|
|
partSpec: '', |
|
|
|
|
|
sku: '', |
|
|
|
|
|
item: '', |
|
|
|
|
|
defaultSupplierNo: '', |
|
|
buyerName: '', |
|
|
buyerName: '', |
|
|
sourcingName: '', |
|
|
sourcingName: '', |
|
|
category: '', |
|
|
category: '', |
|
|
@ -391,14 +465,86 @@ export default { |
|
|
{ |
|
|
{ |
|
|
userId: this.$store.state.user.name, |
|
|
userId: this.$store.state.user.name, |
|
|
functionId: this.functionId, |
|
|
functionId: this.functionId, |
|
|
serialNumber: 'partTableNpc', |
|
|
|
|
|
|
|
|
serialNumber: 'partTableBasePartNo', |
|
|
tableId: 'partTable', |
|
|
tableId: 'partTable', |
|
|
tableName: '产品信息', |
|
|
tableName: '产品信息', |
|
|
columnProp: 'npc', |
|
|
|
|
|
|
|
|
columnProp: 'basePartNo', |
|
|
headerAlign: 'center', |
|
|
headerAlign: 'center', |
|
|
align: 'center', |
|
|
align: 'center', |
|
|
columnLabel: 'NPC货号', |
|
|
|
|
|
columnWidth: '100', |
|
|
|
|
|
|
|
|
columnLabel: '基准料号', |
|
|
|
|
|
columnWidth: '120', |
|
|
|
|
|
columnHidden: false, |
|
|
|
|
|
columnImage: false, |
|
|
|
|
|
columnSortable: false, |
|
|
|
|
|
sortLv: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
fixed: false |
|
|
|
|
|
}, |
|
|
|
|
|
// { |
|
|
|
|
|
// userId: this.$store.state.user.name, |
|
|
|
|
|
// functionId: this.functionId, |
|
|
|
|
|
// serialNumber: 'partTableNpc', |
|
|
|
|
|
// tableId: 'partTable', |
|
|
|
|
|
// tableName: '产品信息', |
|
|
|
|
|
// columnProp: 'npc', |
|
|
|
|
|
// headerAlign: 'center', |
|
|
|
|
|
// align: 'center', |
|
|
|
|
|
// columnLabel: 'NPC货号', |
|
|
|
|
|
// columnWidth: '100', |
|
|
|
|
|
// columnHidden: false, |
|
|
|
|
|
// columnImage: false, |
|
|
|
|
|
// columnSortable: false, |
|
|
|
|
|
// sortLv: 0, |
|
|
|
|
|
// status: true, |
|
|
|
|
|
// fixed: false |
|
|
|
|
|
// }, |
|
|
|
|
|
{ |
|
|
|
|
|
userId: this.$store.state.user.name, |
|
|
|
|
|
functionId: this.functionId, |
|
|
|
|
|
serialNumber: 'partTableItem', |
|
|
|
|
|
tableId: 'partTable', |
|
|
|
|
|
tableName: '产品信息', |
|
|
|
|
|
columnProp: 'item', |
|
|
|
|
|
headerAlign: 'center', |
|
|
|
|
|
align: 'center', |
|
|
|
|
|
columnLabel: 'Item', |
|
|
|
|
|
columnWidth: '120', |
|
|
|
|
|
columnHidden: false, |
|
|
|
|
|
columnImage: false, |
|
|
|
|
|
columnSortable: false, |
|
|
|
|
|
sortLv: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
fixed: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
userId: this.$store.state.user.name, |
|
|
|
|
|
functionId: this.functionId, |
|
|
|
|
|
serialNumber: 'partTableSku', |
|
|
|
|
|
tableId: 'partTable', |
|
|
|
|
|
tableName: '产品信息', |
|
|
|
|
|
columnProp: 'sku', |
|
|
|
|
|
headerAlign: 'center', |
|
|
|
|
|
align: 'center', |
|
|
|
|
|
columnLabel: 'SKU', |
|
|
|
|
|
columnWidth: '120', |
|
|
|
|
|
columnHidden: false, |
|
|
|
|
|
columnImage: false, |
|
|
|
|
|
columnSortable: false, |
|
|
|
|
|
sortLv: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
fixed: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
userId: this.$store.state.user.name, |
|
|
|
|
|
functionId: this.functionId, |
|
|
|
|
|
serialNumber: 'partTableDefaultSupplierNo', |
|
|
|
|
|
tableId: 'partTable', |
|
|
|
|
|
tableName: '产品信息', |
|
|
|
|
|
columnProp: 'defaultSupplierNo', |
|
|
|
|
|
headerAlign: 'center', |
|
|
|
|
|
align: 'center', |
|
|
|
|
|
columnLabel: '默认供应商', |
|
|
|
|
|
columnWidth: '120', |
|
|
columnHidden: false, |
|
|
columnHidden: false, |
|
|
columnImage: false, |
|
|
columnImage: false, |
|
|
columnSortable: false, |
|
|
columnSortable: false, |
|
|
@ -683,9 +829,14 @@ export default { |
|
|
isAdd: true, |
|
|
isAdd: true, |
|
|
currentpart: { |
|
|
currentpart: { |
|
|
partNo: '', |
|
|
partNo: '', |
|
|
|
|
|
basePartNo: '', |
|
|
|
|
|
partSuffix: '', |
|
|
npc: '', |
|
|
npc: '', |
|
|
partDesc: '', |
|
|
partDesc: '', |
|
|
partSpec: '', |
|
|
partSpec: '', |
|
|
|
|
|
sku: '', |
|
|
|
|
|
item: '', |
|
|
|
|
|
defaultSupplierNo: '', |
|
|
buyerName: '', |
|
|
buyerName: '', |
|
|
sourcingName: '', |
|
|
sourcingName: '', |
|
|
category: '', |
|
|
category: '', |
|
|
@ -699,9 +850,6 @@ export default { |
|
|
site: this.$store.state.user.site, |
|
|
site: this.$store.state.user.site, |
|
|
}, |
|
|
}, |
|
|
partRules: { |
|
|
partRules: { |
|
|
partNo: [ |
|
|
|
|
|
{ required: true, message: ' ', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
partDesc: [ |
|
|
partDesc: [ |
|
|
{ required: true, message: ' ', trigger: 'blur' } |
|
|
{ required: true, message: ' ', trigger: 'blur' } |
|
|
], |
|
|
], |
|
|
@ -711,8 +859,19 @@ export default { |
|
|
partSpec: [ |
|
|
partSpec: [ |
|
|
{ required: true, message: ' ', trigger: 'blur' } |
|
|
{ required: true, message: ' ', trigger: 'blur' } |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
copyDialogVisible: false, |
|
|
|
|
|
copyForm: { |
|
|
|
|
|
basePartNo: '', |
|
|
|
|
|
partSuffix: '' |
|
|
|
|
|
}, |
|
|
|
|
|
copyRules: { |
|
|
|
|
|
basePartNo: [ |
|
|
|
|
|
{ required: true, message: '请输入基准料号', trigger: 'blur' } |
|
|
|
|
|
], |
|
|
|
|
|
partSuffix: [ |
|
|
|
|
|
{ required: true, message: '请输入物料后缀', trigger: 'blur' } |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
@ -760,6 +919,68 @@ export default { |
|
|
} |
|
|
} |
|
|
return row[columnProp] |
|
|
return row[columnProp] |
|
|
}, |
|
|
}, |
|
|
|
|
|
generatePartNo (basePartNo, partSuffix) { |
|
|
|
|
|
const base = (basePartNo || '').trim().toUpperCase() |
|
|
|
|
|
const suffix = (partSuffix || '').trim().toUpperCase() |
|
|
|
|
|
if (!base || !suffix) { |
|
|
|
|
|
return '' |
|
|
|
|
|
} |
|
|
|
|
|
return `${base}-${suffix}` |
|
|
|
|
|
}, |
|
|
|
|
|
syncGeneratedPartNo () { |
|
|
|
|
|
if (!this.isAdd) return |
|
|
|
|
|
this.currentpart.partNo = this.generatePartNo(this.currentpart.basePartNo, this.currentpart.partSuffix) |
|
|
|
|
|
}, |
|
|
|
|
|
extractBasePartNo (partNo) { |
|
|
|
|
|
const value = (partNo || '').trim().toUpperCase() |
|
|
|
|
|
if (!value) return '' |
|
|
|
|
|
const index = value.indexOf('-') |
|
|
|
|
|
return index > 0 ? value.substring(0, index) : value |
|
|
|
|
|
}, |
|
|
|
|
|
extractPartSuffix (partNo) { |
|
|
|
|
|
const value = (partNo || '').trim().toUpperCase() |
|
|
|
|
|
if (!value) return '' |
|
|
|
|
|
const index = value.indexOf('-') |
|
|
|
|
|
return index > 0 && index < value.length - 1 ? value.substring(index + 1) : '' |
|
|
|
|
|
}, |
|
|
|
|
|
openCopyDialog () { |
|
|
|
|
|
this.copyForm = { |
|
|
|
|
|
basePartNo: '', |
|
|
|
|
|
partSuffix: '' |
|
|
|
|
|
} |
|
|
|
|
|
this.copyDialogVisible = true |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
if (this.$refs.copyForm) { |
|
|
|
|
|
this.$refs.copyForm.clearValidate() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
confirmCopyPart () { |
|
|
|
|
|
this.$refs.copyForm.validate((valid) => { |
|
|
|
|
|
if (!valid) return |
|
|
|
|
|
const basePartNo = (this.copyForm.basePartNo || '').trim().toUpperCase() |
|
|
|
|
|
const partSuffix = (this.copyForm.partSuffix || '').trim().toUpperCase() |
|
|
|
|
|
if (partSuffix.includes('-')) { |
|
|
|
|
|
this.$message.warning('物料后缀不能包含 "-"') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
copyPartByBase({ |
|
|
|
|
|
site: this.$store.state.user.site, |
|
|
|
|
|
basePartNo, |
|
|
|
|
|
partSuffix |
|
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
this.$message.success(`复制成功,新物料编码:${data.partNo || this.generatePartNo(basePartNo, partSuffix)}`) |
|
|
|
|
|
this.copyDialogVisible = false |
|
|
|
|
|
this.getMainData() |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.$message.error((data && data.msg) || '复制失败') |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
this.$message.error('复制失败: ' + error.message) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
fetchPartFamilyOptions (familyType, parentPartFamily) { |
|
|
fetchPartFamilyOptions (familyType, parentPartFamily) { |
|
|
return listPartFamilyByType({ |
|
|
return listPartFamilyByType({ |
|
|
site: this.$store.state.user.site, |
|
|
site: this.$store.state.user.site, |
|
|
@ -852,9 +1073,6 @@ export default { |
|
|
this.tagNo = val |
|
|
this.tagNo = val |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
let strVal = '' |
|
|
let strVal = '' |
|
|
if (val === 501) { |
|
|
|
|
|
strVal = this.searchData.partNo |
|
|
|
|
|
} |
|
|
|
|
|
if (this.tagNo === 510) { |
|
|
if (this.tagNo === 510) { |
|
|
strVal = this.currentpart.unit |
|
|
strVal = this.currentpart.unit |
|
|
} |
|
|
} |
|
|
@ -868,6 +1086,9 @@ export default { |
|
|
if (val === 527) { |
|
|
if (val === 527) { |
|
|
strVal = this.currentpart.codeNo |
|
|
strVal = this.currentpart.codeNo |
|
|
} |
|
|
} |
|
|
|
|
|
if (val === 501) { |
|
|
|
|
|
strVal = this.currentpart.defaultSupplierNo |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.$refs.baseList.init(val, strVal?strVal:'') |
|
|
this.$refs.baseList.init(val, strVal?strVal:'') |
|
|
}) |
|
|
}) |
|
|
@ -888,6 +1109,9 @@ export default { |
|
|
if (this.tagNo === 527) { |
|
|
if (this.tagNo === 527) { |
|
|
this.currentpart.codeNo = val.code_no |
|
|
this.currentpart.codeNo = val.code_no |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.tagNo === 501) { |
|
|
|
|
|
this.currentpart.defaultSupplierNo = val.SupplierID || val.supplierID || val.supplierId || '' |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getMainData () { |
|
|
getMainData () { |
|
|
@ -1044,9 +1268,14 @@ export default { |
|
|
this.isAdd = true |
|
|
this.isAdd = true |
|
|
this.currentpart = { |
|
|
this.currentpart = { |
|
|
partNo: '', |
|
|
partNo: '', |
|
|
|
|
|
basePartNo: '', |
|
|
|
|
|
partSuffix: '', |
|
|
npc: '', |
|
|
npc: '', |
|
|
partDesc: '', |
|
|
partDesc: '', |
|
|
partSpec: '', |
|
|
partSpec: '', |
|
|
|
|
|
sku: '', |
|
|
|
|
|
item: '', |
|
|
|
|
|
defaultSupplierNo: '', |
|
|
buyerName: '', |
|
|
buyerName: '', |
|
|
sourcingName: '', |
|
|
sourcingName: '', |
|
|
category: '', |
|
|
category: '', |
|
|
@ -1073,22 +1302,82 @@ export default { |
|
|
} |
|
|
} |
|
|
this.isAdd = false |
|
|
this.isAdd = false |
|
|
this.currentpart = {...row} |
|
|
this.currentpart = {...row} |
|
|
|
|
|
// 编辑时基准料号以原值为准,空值保持为空 - rqrq |
|
|
|
|
|
this.currentpart.partSuffix = this.extractPartSuffix(this.currentpart.partNo) |
|
|
this.initPartCategoryOptions(true).then(() => { |
|
|
this.initPartCategoryOptions(true).then(() => { |
|
|
this.partDialogVisible = true |
|
|
this.partDialogVisible = true |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 新增后自动刷新属性模板 - rqrq |
|
|
|
|
|
autoRefreshPartPropertiesAfterCreate () { |
|
|
|
|
|
const site = (this.$store.state.user.site || '').trim().toUpperCase() |
|
|
|
|
|
const partNo = (this.currentpart.partNo || '').trim().toUpperCase() |
|
|
|
|
|
const codeNo = (this.currentpart.codeNo || '').trim().toUpperCase() |
|
|
|
|
|
if (!site || !partNo || !codeNo) { |
|
|
|
|
|
return Promise.resolve(false) |
|
|
|
|
|
} |
|
|
|
|
|
// 新增料号成功后自动刷新属性模板,提前生成属性 - rqrq |
|
|
|
|
|
return refreshPartPropertiesModal({ |
|
|
|
|
|
site, |
|
|
|
|
|
partNo, |
|
|
|
|
|
codeNo, |
|
|
|
|
|
recordType: 'P' |
|
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
this.$message.warning((data && data.msg) || '刷新属性模板失败') |
|
|
|
|
|
return false |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
this.$message.warning('刷新属性模板失败: ' + (error.message || error)) |
|
|
|
|
|
return false |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
// 保存产品 |
|
|
// 保存产品 |
|
|
savePart() { |
|
|
savePart() { |
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
const basePartNo = (this.currentpart.basePartNo || '').trim().toUpperCase() |
|
|
|
|
|
const partSuffix = (this.currentpart.partSuffix || '').trim().toUpperCase() |
|
|
|
|
|
if (!basePartNo || !partSuffix) { |
|
|
|
|
|
this.$message.warning('请填写基准料号和物料后缀') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (partSuffix.includes('-')) { |
|
|
|
|
|
this.$message.warning('物料后缀不能包含 "-"') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (!(this.currentpart.defaultSupplierNo || '').trim()) { |
|
|
|
|
|
this.$message.warning('请填写默认供应商') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.currentpart.defaultSupplierNo = (this.currentpart.defaultSupplierNo || '').trim().toUpperCase() |
|
|
|
|
|
this.currentpart.basePartNo = basePartNo |
|
|
|
|
|
this.currentpart.partSuffix = partSuffix |
|
|
|
|
|
this.currentpart.partNo = this.generatePartNo(basePartNo, partSuffix) |
|
|
|
|
|
} |
|
|
this.$refs.partForm.validate((valid) => { |
|
|
this.$refs.partForm.validate((valid) => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
const apiCall = this.isAdd ? createPart(this.currentpart) : updatePart(this.currentpart) |
|
|
const apiCall = this.isAdd ? createPart(this.currentpart) : updatePart(this.currentpart) |
|
|
|
|
|
|
|
|
apiCall.then(({data}) => { |
|
|
apiCall.then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.$message.success(this.isAdd ? '新增产品成功' : '修改产品成功') |
|
|
|
|
|
this.partDialogVisible = false |
|
|
|
|
|
this.getMainData() |
|
|
|
|
|
|
|
|
const finishSave = (refreshOk) => { |
|
|
|
|
|
const successMsg = this.isAdd |
|
|
|
|
|
? (refreshOk ? '新增产品成功,已刷新属性模板' : '新增产品成功') |
|
|
|
|
|
: '修改产品成功' |
|
|
|
|
|
this.$message.success(successMsg) |
|
|
|
|
|
this.partDialogVisible = false |
|
|
|
|
|
this.getMainData() |
|
|
|
|
|
} |
|
|
|
|
|
// 新增后自动执行“刷新属性模板”按钮同等逻辑 - rqrq |
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
this.autoRefreshPartPropertiesAfterCreate().then((refreshOk) => { |
|
|
|
|
|
finishSave(refreshOk) |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
finishSave(false) |
|
|
} else { |
|
|
} else { |
|
|
this.$message.error(data.msg || '操作失败') |
|
|
this.$message.error(data.msg || '操作失败') |
|
|
} |
|
|
} |
|
|
|