|
|
@ -333,6 +333,15 @@ |
|
|
clearable> |
|
|
clearable> |
|
|
</el-input> |
|
|
</el-input> |
|
|
</el-form-item> |
|
|
</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-form-item label=" "> |
|
|
<el-button type="primary" @click="searchTemplateList">查询</el-button> |
|
|
<el-button type="primary" @click="searchTemplateList">查询</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
@ -626,7 +635,8 @@ |
|
|
customerTemplateList: [],//客户模板列表 |
|
|
customerTemplateList: [],//客户模板列表 |
|
|
templateSearchData: { |
|
|
templateSearchData: { |
|
|
templateName: '', |
|
|
templateName: '', |
|
|
customerName: '' |
|
|
|
|
|
|
|
|
customerName: '', |
|
|
|
|
|
buNo: '' |
|
|
},//模板搜索条件 |
|
|
},//模板搜索条件 |
|
|
cacheKey: '', // 缓存键 |
|
|
cacheKey: '', // 缓存键 |
|
|
cacheTimer: null, // 缓存定时器 |
|
|
cacheTimer: null, // 缓存定时器 |
|
|
@ -1368,6 +1378,7 @@ |
|
|
// 为行选择客户模板 |
|
|
// 为行选择客户模板 |
|
|
selectTemplateForRow(row) { |
|
|
selectTemplateForRow(row) { |
|
|
this.currentRow = row |
|
|
this.currentRow = row |
|
|
|
|
|
this.templateSearchData.buNo = this.pageData.buNo || '' |
|
|
this.getCustomerTemplateList() |
|
|
this.getCustomerTemplateList() |
|
|
this.templateFlag = true |
|
|
this.templateFlag = true |
|
|
}, |
|
|
}, |
|
|
@ -1411,12 +1422,78 @@ |
|
|
this.overseasAddressFlag = true |
|
|
this.overseasAddressFlag = true |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 按BU映射模板的bu_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 = {}) { |
|
|
async getCustomerTemplateList(searchParams = {}) { |
|
|
|
|
|
const requestParams = this.buildTemplateSearchParams(searchParams) |
|
|
try { |
|
|
try { |
|
|
const { data } = await getCustomerTemplateList(searchParams) |
|
|
|
|
|
|
|
|
const { data } = await getCustomerTemplateList(requestParams) |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
this.customerTemplateList = data.rows || [] |
|
|
|
|
|
|
|
|
this.customerTemplateList = this.filterTemplateListByBu(data.rows || [], requestParams.buNo) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.customerTemplateList = [] |
|
|
} |
|
|
} |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('获取客户模板列表失败:', error) |
|
|
console.error('获取客户模板列表失败:', error) |
|
|
@ -1428,7 +1505,8 @@ |
|
|
searchTemplateList() { |
|
|
searchTemplateList() { |
|
|
const searchParams = { |
|
|
const searchParams = { |
|
|
templateName: this.templateSearchData.templateName, |
|
|
templateName: this.templateSearchData.templateName, |
|
|
customerName: this.templateSearchData.customerName |
|
|
|
|
|
|
|
|
customerName: this.templateSearchData.customerName, |
|
|
|
|
|
buNo: this.templateSearchData.buNo || this.pageData.buNo || '' |
|
|
} |
|
|
} |
|
|
this.getCustomerTemplateList(searchParams) |
|
|
this.getCustomerTemplateList(searchParams) |
|
|
}, |
|
|
}, |
|
|
@ -1437,7 +1515,8 @@ |
|
|
resetTemplateSearch() { |
|
|
resetTemplateSearch() { |
|
|
this.templateSearchData = { |
|
|
this.templateSearchData = { |
|
|
templateName: '', |
|
|
templateName: '', |
|
|
customerName: '' |
|
|
|
|
|
|
|
|
customerName: '', |
|
|
|
|
|
buNo: this.pageData.buNo || '' |
|
|
} |
|
|
} |
|
|
this.getCustomerTemplateList() |
|
|
this.getCustomerTemplateList() |
|
|
}, |
|
|
}, |
|
|
@ -1641,6 +1720,13 @@ |
|
|
return |
|
|
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 isNewTemplate = !row.originalTemplateName || row.originalTemplateName === '' |
|
|
const isNameChanged = row.originalTemplateName && row.selectedTemplate !== row.originalTemplateName |
|
|
const isNameChanged = row.originalTemplateName && row.selectedTemplate !== row.originalTemplateName |
|
|
@ -1682,7 +1768,9 @@ |
|
|
overseasShipper: row.selectedOverseasShipper || '', |
|
|
overseasShipper: row.selectedOverseasShipper || '', |
|
|
overseasAddress: row.selectedOverseasAddress || '', |
|
|
overseasAddress: row.selectedOverseasAddress || '', |
|
|
cnative: row.selectedCnative || '', |
|
|
cnative: row.selectedCnative || '', |
|
|
salesArea: row.selectedSalesArea || '' |
|
|
|
|
|
|
|
|
salesArea: row.selectedSalesArea || '', |
|
|
|
|
|
buNo: selectedBuNo || '', |
|
|
|
|
|
templateBuNo: templateBuNo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
|