瀏覽代碼

导入导出

chenrui 2 年之前
父節點
當前提交
5e20acec7d

+ 34 - 0
src/api/product.js

@@ -85,3 +85,37 @@ export const settingPrice = params => {
     method: 'post'
   })
 }
+// 产品信息(箭冠)列表导出
+export const productExportPrice = params => {
+  return axios.request({
+    url: `/product/exportPrice`,
+    method: 'post',
+    data: params,
+    responseType: 'blob'
+  })
+}
+// 产品信息(箭冠)获取导入数据
+export const productImportPrice = params => {
+  return axios({
+    url: '/product/importPrice',
+    data: params,
+    method: 'post'
+  })
+}
+// 产品信息(箭冠)导入
+export const productImportPriceInsertBatch = (params) => {
+  return axios({
+    url: '/product/importPrice/insertBatch',
+    data: params,
+    method: 'post'
+  })
+}
+// 导出错误项
+export const productExportError = (params) => {
+  return axios({
+    url: '/product/importPrice/exportError',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 16 - 13
src/views/productManagement/productInfoJg/chooseImportModal.vue

@@ -4,7 +4,7 @@
     class="chooseImport-modal"
     :footer="null"
     :maskClosable="false"
-    title="确认导入"
+    title="导入"
     v-model="isShow"
     @cancel="isShow=false"
     :width="900">
@@ -37,7 +37,7 @@
         :scroll="{ y: 200 }"
         :pagination="false"
         bordered>
-        <template slot="errorMsg" slot-scope="text,record">
+        <!-- <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>
@@ -46,7 +46,7 @@
               查看
             </a-button>
           </a-popover>
-        </template>
+        </template> -->
       </a-table>
       <!-- 按钮 -->
       <div class="btn-con">
@@ -76,10 +76,12 @@
 </template>
 
 <script>
-import { stockWarnProductImport, stockWarnExportError, stockWarnBatchImport } from '@/api/stockWarn'
+import { commonMixin } from '@/utils/mixin'
+import { productImportPrice, productExportError, productImportPriceInsertBatch } from '@/api/product'
 import { hdExportExcel } from '@/libs/exportExcel'
 export default {
   name: 'ChooseImportModal',
+  mixins: [commonMixin],
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -98,19 +100,20 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       nowColumns: [ //  可导入
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: '26%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         // { title: '在途数(个)', dataIndex: 'inTransit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '自定义终端价', dataIndex: 'upperLimit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '自定义车主价', dataIndex: 'lowerLimit', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? 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) ? _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: 'inTransit', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '自定义终端价', dataIndex: 'upperLimit', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '自定义车主价', dataIndex: 'lowerLimit', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '备注', scopedSlots: { customRender: 'errorMsg' }, width: '10%', align: 'center' }
+        { title: '自定义终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return (text ? parseInt(text) ? _this.toThousands(text) : text : '--') } },
+        { title: '自定义车主价', dataIndex: 'carOwnersPrice', width: '10%', align: 'right', customRender: function (text) { return (text ? parseInt(text) ? _this.toThousands(text) : text : '--') } },
+        { title: '备注', dataIndex: 'errorMsg', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+        // scopedSlots: { customRender: 'errorMsg' },
       ],
       loadData: [],
       unLoadData: [],
@@ -121,7 +124,7 @@ export default {
     getData () {
       const _this = this
       this.loading = true
-      stockWarnProductImport(this.paramsData).then(res => {
+      productImportPrice(this.paramsData).then(res => {
         this.loading = false
         if (res.status == 200) {
           if (res.data.rightList && res.data.rightList.length > 0) {
@@ -146,7 +149,7 @@ export default {
         this.$message.warning('暂无可导入产品!')
       } else {
         this.spinning = true
-        stockWarnBatchImport(this.loadData).then(res => {
+        productImportPriceInsertBatch(this.loadData).then(res => {
           if (res.status == 200) {
             this.$emit('ok', this.loadData)
             this.isShow = false
@@ -163,7 +166,7 @@ export default {
         return
       }
       _this.spinning = true
-      hdExportExcel(stockWarnExportError, _this.unLoadData, '库存预警产品导入错误项', function () {
+      hdExportExcel(productExportError, _this.unLoadData, '库存预警产品导入错误项', function () {
         _this.spinning = false
       })
     }

+ 1 - 1
src/views/productManagement/productInfoJg/importGuideModal.vue

@@ -86,7 +86,7 @@ export default {
       uploadParams: {
         savePathType: 'local'
       },
-      templUrl: location.protocol + '//' + location.host + '/templ/库存预警产品导入模板.xlsx'
+      templUrl: location.protocol + '//' + location.host + '/templ/产品信息管理(箭冠)自定义报价导入模板.xlsx'
     }
   },
   methods: {

+ 18 - 4
src/views/productManagement/productInfoJg/list.vue

@@ -160,11 +160,11 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { productList, getCurrentDealer, productUpdate } from '@/api/product'
+import { productList, getCurrentDealer, productUpdate, productExportPrice } from '@/api/product'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import { STable, VSelect } from '@/components'
-// import { downloadExcel } from '@/libs/JGPrint.js'
+import { downloadExcel } from '@/libs/JGPrint.js'
 import editPriceModal from './editPriceModal.vue'
 import importGuideModal from './importGuideModal.vue'
 export default {
@@ -394,7 +394,22 @@ export default {
     },
     // 导入导出
     handleActions (e) {
-      this.openGuideModal = true
+      if (e.key == 1) {
+        this.openGuideModal = true
+      } else {
+        this.handleExport()
+      }
+    },
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      productExportPrice(params).then(res => {
+        downloadExcel(res, '产品信息管理(箭冠)')
+        _this.exportLoading = false
+        _this.spinning = false
+      })
     }
   },
   watch: {
@@ -407,7 +422,6 @@ export default {
     '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
       this.setTableH()
     }
-
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用