52693 【线上】国家地区清单 导入 导入数据逻辑应该是新增 现在是导入把之前的数据全部替换
This commit is contained in:
@@ -1065,8 +1065,77 @@ export default {
|
||||
}, res => {
|
||||
if(res.ok){
|
||||
if(res.data.length){
|
||||
this.sarAccessInfoList = res.data
|
||||
this.$message.success('文件上传成功')
|
||||
res.data.forEach(item => {
|
||||
// 适用认证转换
|
||||
if (item.syrz !== null) {
|
||||
let k = (item.syrz || "").split(",");
|
||||
for (let i in this.applyAuthOptions) {
|
||||
for (let m = 0; m < k.length; m++) {
|
||||
if (this.applyAuthOptions[i].value === k[m]) {
|
||||
k[m] = this.applyAuthOptions[i].label;
|
||||
}
|
||||
item.syrz = k.join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 能源类型转换
|
||||
if (item.nylx !== null) {
|
||||
let k = (item.nylx || "").split(",");
|
||||
for (let i in this.categoryOptions) {
|
||||
for (let m = 0; m < k.length; m++) {
|
||||
if (this.categoryOptions[i].value === k[m]) {
|
||||
k[m] = this.categoryOptions[i].label;
|
||||
}
|
||||
item.nylx = k.join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 适用产品线转换
|
||||
if (item.sycpx !== null) {
|
||||
let k = (item.sycpx || "").split(',')
|
||||
for (let i in this.sycpxOptions) {
|
||||
for (let m = 0; m < k.length; m++) {
|
||||
if (this.sycpxOptions[i].value === k[m]) {
|
||||
k[m] = this.sycpxOptions[i].label
|
||||
}
|
||||
item.sycpx = k.join(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
// 适用车型转换
|
||||
if (item.sycx !== null) {
|
||||
let k = (item.sycx || "").split(",");
|
||||
for (let i in this.energyKindOptions) {
|
||||
for (let m = 0; m < k.length; m++) {
|
||||
if (this.energyKindOptions[i].value === k[m]) {
|
||||
k[m] = this.energyKindOptions[i].label;
|
||||
}
|
||||
item.sycx = k.join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
let repeatIndex = 0;
|
||||
if(this.sarAccessInfoList.length){
|
||||
res.data.map(item =>{
|
||||
let addIndex;
|
||||
addIndex = this.sarAccessInfoList.findIndex(items => {
|
||||
return items.id === item.id
|
||||
})
|
||||
if(addIndex > -1){
|
||||
repeatIndex++
|
||||
}else{
|
||||
this.sarAccessInfoList.push(item)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.sarAccessInfoList = res.data
|
||||
}
|
||||
if(repeatIndex > 0){
|
||||
this.$message.warning('请勿上传重复标准,重复标准未添加')
|
||||
}else{
|
||||
this.$message.success('导入文件成功')
|
||||
}
|
||||
}else{
|
||||
this.$message.warning('请勿上传为空的文件')
|
||||
}
|
||||
@@ -1787,7 +1856,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
// s适用产品线转换
|
||||
// 适用产品线转换
|
||||
if (item.sycpx !== null) {
|
||||
let k = (item.sycpx || "").split(',')
|
||||
for (let i in this.sycpxOptions) {
|
||||
|
||||
Reference in New Issue
Block a user