han\hanst 1 day ago
parent
commit
f9f2218320
  1. 100
      src/views/modules/ecss/del_upload_excel.vue
  2. 100
      src/views/modules/ecss/del_upload_excel_tx.vue

100
src/views/modules/ecss/del_upload_excel.vue

@ -333,6 +333,15 @@
clearable>
</el-input>
</el-form-item>
<el-form-item label="BU">
<el-select
v-model="templateSearchData.buNo"
placeholder="请选择BU"
style="width: 200px;"
clearable>
<el-option v-for="i in buList" :key="`template-${i.buNo}`" :label="i.buDesc" :value="i.buNo"></el-option>
</el-select>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchTemplateList">查询</el-button>
</el-form-item>
@ -626,7 +635,8 @@
customerTemplateList: [],//
templateSearchData: {
templateName: '',
customerName: ''
customerName: '',
buNo: ''
},//
cacheKey: '', //
cacheTimer: null, //
@ -1368,6 +1378,7 @@
//
selectTemplateForRow(row) {
this.currentRow = row
this.templateSearchData.buNo = this.pageData.buNo || ''
this.getCustomerTemplateList()
this.templateFlag = true
},
@ -1411,12 +1422,78 @@
this.overseasAddressFlag = true
},
// BUbu_no
getTemplateBuNoByBu(buNo) {
const sourceBu = (buNo || '').toString().trim()
if (!sourceBu) {
return ''
}
const upperBu = sourceBu.toUpperCase()
const buCodeMatch = upperBu.match(/\d{2}/)
const buCode = buCodeMatch ? buCodeMatch[0] : ''
if (['01', '03'].includes(buCode) || upperBu.includes('RFID') || upperBu.includes('LABEL') || upperBu.includes('软标')) {
return '03-RFID,01-Label'
}
if (['02', '05'].includes(buCode) || upperBu.includes('HARD') || upperBu.includes('ALPHA') || upperBu.includes('硬标')) {
return '02-Hardtag,05-Alpha'
}
if (buCode === '04' || upperBu.includes('MHM') || upperBu.includes('天线')) {
return '04-MHM'
}
return sourceBu
},
// bu_no
parseTemplateBuNoList(templateBuNo) {
return (templateBuNo || '')
.toString()
.split(',')
.map(item => item.trim())
.filter(item => item)
},
//
buildTemplateSearchParams(searchParams = {}) {
const mergedBuNo = searchParams.buNo !== undefined
? searchParams.buNo
: (this.templateSearchData.buNo || this.pageData.buNo || '')
const templateBuNo = this.getTemplateBuNoByBu(mergedBuNo)
const params = {
templateName: searchParams.templateName !== undefined ? searchParams.templateName : this.templateSearchData.templateName,
customerName: searchParams.customerName !== undefined ? searchParams.customerName : this.templateSearchData.customerName
}
if (mergedBuNo) {
params.buNo = mergedBuNo
}
if (templateBuNo) {
params.templateBuNo = templateBuNo
}
return params
},
// BU
filterTemplateListByBu(templateList, selectedBuNo) {
const expectedBuList = this.parseTemplateBuNoList(this.getTemplateBuNoByBu(selectedBuNo))
if (expectedBuList.length === 0) {
return templateList || []
}
return (templateList || []).filter(item => {
const itemBuList = this.parseTemplateBuNoList(item.bu_no || item.buNo)
return itemBuList.some(itemBu => expectedBuList.includes(itemBu))
})
},
//
async getCustomerTemplateList(searchParams = {}) {
const requestParams = this.buildTemplateSearchParams(searchParams)
try {
const { data } = await getCustomerTemplateList(searchParams)
const { data } = await getCustomerTemplateList(requestParams)
if (data && data.code === 0) {
this.customerTemplateList = data.rows || []
this.customerTemplateList = this.filterTemplateListByBu(data.rows || [], requestParams.buNo)
} else {
this.customerTemplateList = []
}
} catch (error) {
console.error('获取客户模板列表失败:', error)
@ -1428,7 +1505,8 @@
searchTemplateList() {
const searchParams = {
templateName: this.templateSearchData.templateName,
customerName: this.templateSearchData.customerName
customerName: this.templateSearchData.customerName,
buNo: this.templateSearchData.buNo || this.pageData.buNo || ''
}
this.getCustomerTemplateList(searchParams)
},
@ -1437,7 +1515,8 @@
resetTemplateSearch() {
this.templateSearchData = {
templateName: '',
customerName: ''
customerName: '',
buNo: this.pageData.buNo || ''
}
this.getCustomerTemplateList()
},
@ -1641,6 +1720,13 @@
return
}
const selectedBuNo = this.pageData.buNo || this.templateSearchData.buNo
const templateBuNo = this.getTemplateBuNoByBu(selectedBuNo)
if (!templateBuNo) {
this.$message.warning('请先选择BU')
return
}
//
const isNewTemplate = !row.originalTemplateName || row.originalTemplateName === ''
const isNameChanged = row.originalTemplateName && row.selectedTemplate !== row.originalTemplateName
@ -1682,7 +1768,9 @@
overseasShipper: row.selectedOverseasShipper || '',
overseasAddress: row.selectedOverseasAddress || '',
cnative: row.selectedCnative || '',
salesArea: row.selectedSalesArea || ''
salesArea: row.selectedSalesArea || '',
buNo: selectedBuNo || '',
templateBuNo: templateBuNo
}
try {

100
src/views/modules/ecss/del_upload_excel_tx.vue

@ -333,6 +333,15 @@
clearable>
</el-input>
</el-form-item>
<el-form-item label="BU">
<el-select
v-model="templateSearchData.buNo"
placeholder="请选择BU"
style="width: 200px;"
clearable>
<el-option v-for="i in buList" :key="`template-${i.buNo}`" :label="i.buDesc" :value="i.buNo"></el-option>
</el-select>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchTemplateList">查询</el-button>
</el-form-item>
@ -626,7 +635,8 @@
customerTemplateList: [],//
templateSearchData: {
templateName: '',
customerName: ''
customerName: '',
buNo: ''
},//
cacheKey: '', //
cacheTimer: null, //
@ -1368,6 +1378,7 @@
//
selectTemplateForRow(row) {
this.currentRow = row
this.templateSearchData.buNo = this.pageData.buNo || ''
this.getCustomerTemplateList()
this.templateFlag = true
},
@ -1411,12 +1422,78 @@
this.overseasAddressFlag = true
},
// BUbu_no
getTemplateBuNoByBu(buNo) {
const sourceBu = (buNo || '').toString().trim()
if (!sourceBu) {
return ''
}
const upperBu = sourceBu.toUpperCase()
const buCodeMatch = upperBu.match(/\d{2}/)
const buCode = buCodeMatch ? buCodeMatch[0] : ''
if (['01', '03'].includes(buCode) || upperBu.includes('RFID') || upperBu.includes('LABEL') || upperBu.includes('软标')) {
return '03-RFID,01-Label'
}
if (['02', '05'].includes(buCode) || upperBu.includes('HARD') || upperBu.includes('ALPHA') || upperBu.includes('硬标')) {
return '02-Hardtag,05-Alpha'
}
if (buCode === '04' || upperBu.includes('MHM') || upperBu.includes('天线')) {
return '04-MHM'
}
return sourceBu
},
// bu_no
parseTemplateBuNoList(templateBuNo) {
return (templateBuNo || '')
.toString()
.split(',')
.map(item => item.trim())
.filter(item => item)
},
//
buildTemplateSearchParams(searchParams = {}) {
const mergedBuNo = searchParams.buNo !== undefined
? searchParams.buNo
: (this.templateSearchData.buNo || this.pageData.buNo || '')
const templateBuNo = this.getTemplateBuNoByBu(mergedBuNo)
const params = {
templateName: searchParams.templateName !== undefined ? searchParams.templateName : this.templateSearchData.templateName,
customerName: searchParams.customerName !== undefined ? searchParams.customerName : this.templateSearchData.customerName
}
if (mergedBuNo) {
params.buNo = mergedBuNo
}
if (templateBuNo) {
params.templateBuNo = templateBuNo
}
return params
},
// BU
filterTemplateListByBu(templateList, selectedBuNo) {
const expectedBuList = this.parseTemplateBuNoList(this.getTemplateBuNoByBu(selectedBuNo))
if (expectedBuList.length === 0) {
return templateList || []
}
return (templateList || []).filter(item => {
const itemBuList = this.parseTemplateBuNoList(item.bu_no || item.buNo)
return itemBuList.some(itemBu => expectedBuList.includes(itemBu))
})
},
//
async getCustomerTemplateList(searchParams = {}) {
const requestParams = this.buildTemplateSearchParams(searchParams)
try {
const { data } = await getCustomerTemplateList(searchParams)
const { data } = await getCustomerTemplateList(requestParams)
if (data && data.code === 0) {
this.customerTemplateList = data.rows || []
this.customerTemplateList = this.filterTemplateListByBu(data.rows || [], requestParams.buNo)
} else {
this.customerTemplateList = []
}
} catch (error) {
console.error('获取客户模板列表失败:', error)
@ -1428,7 +1505,8 @@
searchTemplateList() {
const searchParams = {
templateName: this.templateSearchData.templateName,
customerName: this.templateSearchData.customerName
customerName: this.templateSearchData.customerName,
buNo: this.templateSearchData.buNo || this.pageData.buNo || ''
}
this.getCustomerTemplateList(searchParams)
},
@ -1437,7 +1515,8 @@
resetTemplateSearch() {
this.templateSearchData = {
templateName: '',
customerName: ''
customerName: '',
buNo: this.pageData.buNo || ''
}
this.getCustomerTemplateList()
},
@ -1641,6 +1720,13 @@
return
}
const selectedBuNo = this.pageData.buNo || this.templateSearchData.buNo
const templateBuNo = this.getTemplateBuNoByBu(selectedBuNo)
if (!templateBuNo) {
this.$message.warning('请先选择BU')
return
}
//
const isNewTemplate = !row.originalTemplateName || row.originalTemplateName === ''
const isNameChanged = row.originalTemplateName && row.selectedTemplate !== row.originalTemplateName
@ -1682,7 +1768,9 @@
overseasShipper: row.selectedOverseasShipper || '',
overseasAddress: row.selectedOverseasAddress || '',
cnative: row.selectedCnative || '',
salesArea: row.selectedSalesArea || ''
salesArea: row.selectedSalesArea || '',
buNo: selectedBuNo || '',
templateBuNo: templateBuNo
}
try {

Loading…
Cancel
Save