|
@@ -7,7 +7,7 @@
|
|
|
title="导入"
|
|
|
v-model="isShow"
|
|
|
@cancel="isShow=false"
|
|
|
- width="65%">
|
|
|
+ width="75%">
|
|
|
<div class="chooseImport-con">
|
|
|
<!-- 可导入数据 -->
|
|
|
<p class="">可导入数据{{ loadData.length }}条</p>
|
|
@@ -37,16 +37,11 @@
|
|
|
:scroll="{ y: 200 }"
|
|
|
:pagination="false"
|
|
|
bordered>
|
|
|
- <!-- <template slot="errorMsg" slot-scope="text,record">
|
|
|
- <a-popover placement="topRight">
|
|
|
- <template slot="content">
|
|
|
- <p v-for="d in record.importErrorMsgSet" v-if="d">{{ d }};</p>
|
|
|
- </template>
|
|
|
- <a-button type="link">
|
|
|
- 查看
|
|
|
- </a-button>
|
|
|
- </a-popover>
|
|
|
- </template> -->
|
|
|
+ <template slot="errorMsg" slot-scope="text,record">
|
|
|
+ <div v-if="record.importErrorMsgSet&&record.importErrorMsgSet.length>0">
|
|
|
+ <p v-for="(con,i) in record.importErrorMsgSet" :key="i">{{ i*1+1 }}、{{ con }};</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</a-table>
|
|
|
<!-- 按钮 -->
|
|
|
<div class="btn-con">
|
|
@@ -77,7 +72,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { productImportPrice, productExportError, productImportPriceInsertBatch } from '@/api/product'
|
|
|
+import { dealerProductExportError, importRightListProduct } from '@/api/dealerProduct'
|
|
|
import { hdExportExcel } from '@/libs/exportExcel'
|
|
|
export default {
|
|
|
name: 'ChooseImportModal',
|
|
@@ -100,28 +95,34 @@ export default {
|
|
|
isShow: this.openModal, // 是否打开弹框
|
|
|
nowColumns: [ // 可导入
|
|
|
{ title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'inTransit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品编码', dataIndex: 'inTransit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品分类', dataIndex: 'inTransit', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '经销商批发价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '原厂编码', dataIndex: 'otherCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '条形码', dataIndex: 'qrCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '基本单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrandName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品一级分类', dataIndex: 'productTypeName1', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品二级分类', dataIndex: 'productTypeName2', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品三级分类', dataIndex: 'productTypeName3', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '经销商批发价', dataIndex: 'specialPrice', width: '13%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
{ title: '终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '车主价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '可用库存', dataIndex: 'carOwnersPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
|
|
|
+ { title: '车主价', dataIndex: 'carOwnersPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
|
|
|
],
|
|
|
nowUnColumns: [ // 不可导入
|
|
|
{ title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '18%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'inTransit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品编码', dataIndex: 'inTransit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品分类', dataIndex: 'inTransit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '经销商批发价', dataIndex: 'terminalPrice', width: '12%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '车主价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '可用库存', dataIndex: 'carOwnersPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '备注', dataIndex: 'errorMsg', width: '16%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '原厂编码', dataIndex: 'otherCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '条形码', dataIndex: 'qrCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '基本单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品品牌', dataIndex: 'productBrandName', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品一级分类', dataIndex: 'productTypeName1', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品二级分类', dataIndex: 'productTypeName2', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品三级分类', dataIndex: 'productTypeName3', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '经销商批发价', dataIndex: 'specialPrice', width: '13%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '终端价', dataIndex: 'terminalPrice', width: '11%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '车主价', dataIndex: 'carOwnersPrice', width: '11%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '备注', width: '20%', align: 'center', scopedSlots: { customRender: 'errorMsg' } }
|
|
|
],
|
|
|
loadData: [],
|
|
|
unLoadData: [],
|
|
@@ -129,26 +130,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取数据
|
|
|
getData () {
|
|
|
- const _this = this
|
|
|
- this.loading = true
|
|
|
- productImportPrice(this.paramsData).then(res => {
|
|
|
- this.loading = false
|
|
|
- if (res.status == 200) {
|
|
|
- if (res.data.rightList && res.data.rightList.length > 0) {
|
|
|
- res.data.rightList.map((item, index) => {
|
|
|
- item.no = index + 1
|
|
|
- })
|
|
|
- }
|
|
|
- if (res.data.errorList && res.data.errorList.length > 0) {
|
|
|
- res.data.errorList.map((item, index) => {
|
|
|
- item.no = index + 1
|
|
|
- item.importErrorMsgSet = item.errorMsg ? item.errorMsg.split(';') : []
|
|
|
- })
|
|
|
- }
|
|
|
- _this.loadData = res.data.rightList || []
|
|
|
- _this.unLoadData = res.data.errorList || []
|
|
|
- }
|
|
|
+ const paramsData = JSON.parse(JSON.stringify(this.paramsData))
|
|
|
+ this.loadData = paramsData.rightList || []
|
|
|
+ this.unLoadData = paramsData.errorList || []
|
|
|
+ // 正确的
|
|
|
+ this.loadData.map((item, index) => {
|
|
|
+ item.no = index + 1
|
|
|
+ })
|
|
|
+ // 错误的
|
|
|
+ this.unLoadData.map((item, index) => {
|
|
|
+ item.no = index + 1
|
|
|
})
|
|
|
},
|
|
|
// 确认导入
|
|
@@ -157,7 +150,7 @@ export default {
|
|
|
this.$message.warning('暂无可导入产品!')
|
|
|
} else {
|
|
|
this.spinning = true
|
|
|
- productImportPriceInsertBatch(this.loadData).then(res => {
|
|
|
+ importRightListProduct(this.loadData).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$emit('ok', this.loadData)
|
|
|
this.isShow = false
|
|
@@ -174,7 +167,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
_this.spinning = true
|
|
|
- hdExportExcel(productExportError, _this.unLoadData, '库存预警产品导入错误项', function () {
|
|
|
+ hdExportExcel(dealerProductExportError, _this.unLoadData, '自建产品导入错误项', function () {
|
|
|
_this.spinning = false
|
|
|
})
|
|
|
}
|