فهرست منبع

Merge branch 'develop_yh48-2' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop_yh48-2

lilei 8 ماه پیش
والد
کامیت
4f7545e261

+ 0 - 0
public/templ/产品信息列表(自建)导入模板.xlsx → public/templ/自建产品导入模板.xlsx


+ 25 - 0
src/api/dealerProduct.js

@@ -106,3 +106,28 @@ export const dealerProductPriceList = (params) => {
     }
     }
   })
   })
 }
 }
+
+// 产品信息管理(自建) 确定导入
+export const importRightListProduct = (params) => {
+  return axios({
+    url: '/dealerProduct/importRightListProduct',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('产品信息管理(自建)确定导入')
+    }
+  })
+}
+
+// 产品信息管理(自建) 导出错误项
+export const dealerProductExportError = params => {
+  return axios({
+    url: '/dealerProduct/exportImportError',
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers: {
+      'module': encodeURIComponent('自建产品导入错误项')
+    }
+  })
+}

+ 44 - 51
src/views/productManagement/productInfo/chooseImportModal.vue

@@ -7,7 +7,7 @@
     title="导入"
     title="导入"
     v-model="isShow"
     v-model="isShow"
     @cancel="isShow=false"
     @cancel="isShow=false"
-    width="65%">
+    width="75%">
     <div class="chooseImport-con">
     <div class="chooseImport-con">
       <!-- 可导入数据 -->
       <!-- 可导入数据 -->
       <p class="">可导入数据{{ loadData.length }}条</p>
       <p class="">可导入数据{{ loadData.length }}条</p>
@@ -37,16 +37,11 @@
         :scroll="{ y: 200 }"
         :scroll="{ y: 200 }"
         :pagination="false"
         :pagination="false"
         bordered>
         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>
       </a-table>
       <!-- 按钮 -->
       <!-- 按钮 -->
       <div class="btn-con">
       <div class="btn-con">
@@ -77,7 +72,7 @@
 
 
 <script>
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
-import { productImportPrice, productExportError, productImportPriceInsertBatch } from '@/api/product'
+import { dealerProductExportError, importRightListProduct } from '@/api/dealerProduct'
 import { hdExportExcel } from '@/libs/exportExcel'
 import { hdExportExcel } from '@/libs/exportExcel'
 export default {
 export default {
   name: 'ChooseImportModal',
   name: 'ChooseImportModal',
@@ -100,28 +95,34 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
       nowColumns: [ //  可导入
       nowColumns: [ //  可导入
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { 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: '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: [ //  不可导入
       nowUnColumns: [ //  不可导入
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { 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: [],
       loadData: [],
       unLoadData: [],
       unLoadData: [],
@@ -129,26 +130,18 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
+    // 获取数据
     getData () {
     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('暂无可导入产品!')
         this.$message.warning('暂无可导入产品!')
       } else {
       } else {
         this.spinning = true
         this.spinning = true
-        productImportPriceInsertBatch(this.loadData).then(res => {
+        importRightListProduct(this.loadData).then(res => {
           if (res.status == 200) {
           if (res.status == 200) {
             this.$emit('ok', this.loadData)
             this.$emit('ok', this.loadData)
             this.isShow = false
             this.isShow = false
@@ -174,7 +167,7 @@ export default {
         return
         return
       }
       }
       _this.spinning = true
       _this.spinning = true
-      hdExportExcel(productExportError, _this.unLoadData, '库存预警产品导入错误项', function () {
+      hdExportExcel(dealerProductExportError, _this.unLoadData, '自建产品导入错误项', function () {
         _this.spinning = false
         _this.spinning = false
       })
       })
     }
     }

+ 14 - 7
src/views/productManagement/productInfo/importGuideModal.vue

@@ -32,10 +32,11 @@
               ref="importUpload"
               ref="importUpload"
               :maxNums="1"
               :maxNums="1"
               fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
               fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
-              uploadType="import"
+              uploadType="attach"
               :action="attachAction"
               :action="attachAction"
               :uploadParams="uploadParams"
               :uploadParams="uploadParams"
               upText="选择导入文件"
               upText="选择导入文件"
+              @remove="resetSearchForm"
               @change="changeImport"></Upload>
               @change="changeImport"></Upload>
           </div>
           </div>
         </div>
         </div>
@@ -82,15 +83,20 @@ export default {
     return {
     return {
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
       openImportModal: false, //  导入
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/dealerProduct/importProduct', // 接口
       paramsData: null,
       paramsData: null,
       uploadParams: {
       uploadParams: {
         savePathType: 'local'
         savePathType: 'local'
       },
       },
-      templUrl: location.protocol + '//' + location.host + '/templ/产品信息列表(自建)导入模板.xlsx'
+      templUrl: location.protocol + '//' + location.host + '/templ/自建产品导入模板.xlsx'
     }
     }
   },
   },
   methods: {
   methods: {
+    // 清空数据
+    resetSearchForm () {
+      this.$refs.importUpload.setFileList() //  清空导入文件
+      this.paramsData = null //  清空上传数据
+    },
     // 下一步
     // 下一步
     handlerNextStep () {
     handlerNextStep () {
       if (this.paramsData) {
       if (this.paramsData) {
@@ -101,10 +107,11 @@ export default {
     },
     },
     // 上传文件  change
     // 上传文件  change
     changeImport (file) {
     changeImport (file) {
-      if (file) {
-        this.paramsData = {
-          path: file
-        }
+      // console.log(file, JSON.parse(file))
+      if (file && JSON.parse(file).length > 0) {
+        this.paramsData = Object.assign({}, JSON.parse(file)[0] || null, this.params)
+      } else {
+        this.paramsData = null
       }
       }
     },
     },
     // 导入
     // 导入

+ 3 - 2
src/views/productManagement/productInfo/list.vue

@@ -305,6 +305,7 @@ export default {
     // 查询
     // 查询
     searchForm () {
     searchForm () {
       this.$refs.table.clearSelected() // 清空表格选中项
       this.$refs.table.clearSelected() // 清空表格选中项
+      this.rowSelectionInfo = null
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
     //  重置
     //  重置
@@ -319,8 +320,8 @@ export default {
       this.queryParam.enabledFlag = undefined
       this.queryParam.enabledFlag = undefined
       this.queryParam.stockEmptyFlag = undefined
       this.queryParam.stockEmptyFlag = undefined
       this.productType = []
       this.productType = []
-      this.$refs.table.clearSelected()
-      this.rowSelectionInfo = null
+      // this.$refs.table.clearSelected()
+      // this.rowSelectionInfo = null
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
     //  新增/编辑
     //  新增/编辑

+ 16 - 10
src/views/promotionManagement/promotionInfo/chooseProductsModal.vue

@@ -29,12 +29,12 @@
               </a-col>
               </a-col>
               <a-col :md="8" :sm="24">
               <a-col :md="8" :sm="24">
                 <a-form-model-item label="原厂编码">
                 <a-form-model-item label="原厂编码">
-                  <a-input id="chooseProducts-code" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
+                  <a-input id="chooseProducts-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
               <a-col :md="8" :sm="24">
               <a-col :md="8" :sm="24">
                 <a-form-model-item label="产品名称">
                 <a-form-model-item label="产品名称">
-                  <a-input id="chooseProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+                  <a-input id="chooseProducts-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
               <a-col :md="8" :sm="24">
               <a-col :md="8" :sm="24">
@@ -55,7 +55,7 @@
           </a-form-model>
           </a-form-model>
         </div>
         </div>
         <div style="margin-bottom: 10px">
         <div style="margin-bottom: 10px">
-          <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
+          <a-button type="primary" ghost id="chooseProducts-save" :loading="loading" @click="handleSave">批量添加</a-button>
           <span style="margin-left: 5px">
           <span style="margin-left: 5px">
             <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
             <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
           </span>
           </span>
@@ -96,10 +96,13 @@
 
 
 <script>
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { commonMixin } from '@/utils/mixin'
+// 组件
 import { STable } from '@/components'
 import { STable } from '@/components'
-import { queryWaitingProductPage } from '@/api/promoActive'
 import ProductBrand from '@/views/common/productBrand.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import ProductType from '../../common/productType.js'
 import ProductType from '../../common/productType.js'
+// 接口
+import { queryWaitingProductPage } from '@/api/promoActive'
+
 export default {
 export default {
   name: 'ChooseProductsModal',
   name: 'ChooseProductsModal',
   components: { STable, ProductBrand, ProductType },
   components: { STable, ProductBrand, ProductType },
@@ -141,25 +144,28 @@ export default {
     return {
     return {
       spinning: false,
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
+      // form表单label布局设置
       formItemLayout: {
       formItemLayout: {
         labelCol: { span: 4 },
         labelCol: { span: 4 },
         wrapperCol: { span: 20 }
         wrapperCol: { span: 20 }
       },
       },
-      queryParam: { //  查询条件
+      //  查询条件
+      queryParam: {
         productName: '', // 产品名称
         productName: '', // 产品名称
         productCode: '', //  产品编码
         productCode: '', //  产品编码
         origCode: '', // 原厂编码
         origCode: '', // 原厂编码
         productBrandSn: undefined, //  产品品牌
         productBrandSn: undefined, //  产品品牌
-        productType: [],
+        productType: [], // 产品分类
         productTypeSn1: '', //  产品一级分类
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
         productTypeSn3: '', //  产品三级分类
-        hideProductSnList: [],
-        productTypeSnList: []
+        hideProductSnList: [], // 已选产品数据
+        productTypeSnList: []// 已选产品类型
       },
       },
-      chooseDataList: [],
+      chooseDataList: [], // 已选产品数据
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
       loading: false, //  表格加载中
       loading: false, //  表格加载中
+      // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '产品编码', dataIndex: 'code', align: 'center' },
         { title: '产品编码', dataIndex: 'code', align: 'center' },
@@ -211,7 +217,7 @@ export default {
           return data
           return data
         })
         })
       },
       },
-      rowSelectionInfo: null
+      rowSelectionInfo: null // 表格选中项
     }
     }
   },
   },
   computed: {
   computed: {

+ 2 - 0
src/views/promotionManagement/promotionInfo/list.vue

@@ -223,12 +223,14 @@ export default {
       this.queryParam.promoState = undefined
       this.queryParam.promoState = undefined
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
+    // 初始化
     pageInit () {
     pageInit () {
       const _this = this
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
         _this.setTableH()
       })
       })
     },
     },
+    // 计算表格高度
     setTableH () {
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 203
       this.tableHeight = window.innerHeight - tableSearchH - 203