浏览代码

对接产品

chenrui 4 年之前
父节点
当前提交
cc2ff3b450

+ 13 - 0
src/api/product.js

@@ -0,0 +1,13 @@
+import { axios } from '@/utils/request'
+
+//  箭冠 产品 列表  分页
+export const productList = (params) => {
+  const url = `/product/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 10 - 0
src/api/productBrand.js

@@ -0,0 +1,10 @@
+import { axios } from '@/utils/request'
+
+//  箭冠 产品品牌 列表
+export const productBrandQuery = (params) => {
+  return axios({
+    url: '/productBrand/queryList',
+    data: params,
+    method: 'post'
+  })
+}

+ 10 - 0
src/api/productType.js

@@ -0,0 +1,10 @@
+import { axios } from '@/utils/request'
+
+//  箭冠 产品分类 列表
+export const productTypeQuery = (params) => {
+  return axios({
+    url: '/productType/queryList',
+    data: params,
+    method: 'post'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -973,6 +973,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/productManagement/productInfoJg',
+            redirect: '/productManagement/productInfoJg/list',
+            name: 'productInfoJg',
+            component: RouteView,
+            meta: {
+              title: '产品信息管理(箭冠)',
+              icon: 'file-text'
+              // permission: 'M_goodsManage_list'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'productInfoJgList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/productManagement/productInfoJg/list.vue'),
+                meta: {
+                  title: '产品信息列表',
+                  icon: 'file-text',
+                  hidden: true
+                  // permission: 'M_goodsManage_list'
+                }
+              }
+            ]
+          },
           {
             path: '/productManagement/productBrand',
             redirect: '/productManagement/productBrand/list',

+ 138 - 112
src/views/productManagement/productInfo/edit.vue

@@ -1,113 +1,127 @@
 <template>
-  <a-card size="small" :bordered="false" class="productInfoEdit-table-page-wrapper">
-    <a-form-model
-      id="productInfoEdit-form"
-      ref="ruleForm"
-      :model="form"
-      :rules="rules"
-      :label-col="formItemLayout.labelCol"
-      :wrapper-col="formItemLayout.wrapperCol"
-    >
-      <a-form-model-item label="产品名称" prop="name">
-        <a-input
-          id="productInfoEdit-name"
-          :maxLength="30"
-          v-model="form.name"
-          placeholder="请输入产品名称(最多30个字符)"
-          allowClear />
-      </a-form-model-item>
-      <a-form-model-item label="产品编码" prop="code">
-        <a-input
-          id="productInfoEdit-code"
-          :maxLength="30"
-          :disabled="!!$route.params.id"
-          v-model="form.code"
-          placeholder="请输入产品编码(最多30个字符)"
-          allowClear />
-      </a-form-model-item>
-      <a-form-model-item label="原厂编码" prop="origCode">
-        <a-input
-          id="productInfoEdit-origCode"
-          :maxLength="30"
-          v-model="form.origCode"
-          placeholder="请输入原厂编码(最多30个字符)"
-          allowClear />
-      </a-form-model-item>
-      <a-form-model-item label="基本单位" prop="unit">
-        <a-input
-          id="productInfoEdit-unit"
-          :maxLength="30"
-          v-model="form.unit"
-          placeholder="请输入基本单位(最多30个字符)"
-          allowClear />
-      </a-form-model-item>
-      <a-form-model-item label="产品品牌" prop="productBrandSn">
-        <a-select
-          id="productInfoEdit-productBrand"
-          placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
-          :disabled="!!$route.params.id"
-          allowClear
-          v-model="form.productBrandSn"
-          :showSearch="true"
-          option-filter-prop="children"
-          :filter-option="filterOption"
-          style="width: 90%;">
-          <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn" :disabled="item.enabledFlag==0">{{ item.brandName }}</a-select-option>
-        </a-select>
-        <a-button @click="openModal=true" icon="plus" size="small" id="productInfoEdit-add-btn" style="margin-left: 5px;"></a-button>
-      </a-form-model-item>
-      <a-form-model-item label="产品分类" prop="productType">
-        <a-cascader
-          :disabled="!!$route.params.id"
-          @change="changeProductType"
-          :options="productTypeList"
-          :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
-          id="productInfoEdit-productType"
-          placeholder="请选择产品分类"
-          allowClear
-          v-model="form.productType" />
-      </a-form-model-item>
-      <a-form-model-item label="经销批发价" prop="specialPrice">
-        <a-input-number
-          id="productInfoEdit-specialPrice"
-          v-model="form.specialPrice"
-          :min="0"
-          :max="999999"
-          :precision="2"
-          style="width: 90%;margin-right: 5px;"
-          placeholder="请输入经销批发价(0~999999)"
-          allowClear /><span>元</span>
-      </a-form-model-item>
-      <a-form-model-item label="终端价" prop="terminalPrice">
-        <a-input-number
-          id="productInfoEdit-terminalPrice"
-          v-model="form.terminalPrice"
-          :min="0"
-          :max="999999"
-          :precision="2"
-          style="width: 90%;margin-right: 5px;"
-          placeholder="请输入终端价(0~999999)"
-          allowClear /><span>元</span>
-      </a-form-model-item>
-      <a-form-model-item label="车主价" prop="carOwnersPrice">
-        <a-input-number
-          id="productInfoEdit-carOwnersPrice"
-          v-model="form.carOwnersPrice"
-          :min="0"
-          :max="999999"
-          :precision="2"
-          style="width: 90%;margin-right: 5px;"
-          placeholder="请输入车主价(0~999999)"
-          allowClear /><span>元</span>
-      </a-form-model-item>
-      <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
-        <a-button type="primary" @click="handleSubmit" id="productInfoEdit-btn-submit">保存</a-button>
-        <a-button @click="goBack" style="margin-left: 15px" id="productInfoEdit-btn-back">返回列表</a-button>
-      </a-form-model-item>
-    </a-form-model>
-    <!-- 新增/编辑产品品牌 -->
-    <product-brand-edit-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
-  </a-card>
+  <div class="productInfoEdit-wrap">
+    <a-page-header :ghost="false" @back="handleBack" class="productInfoEdit-back">
+      <!-- 自定义的二级文字标题 -->
+      <template slot="subTitle">
+        <a id="productInfoEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+      </template>
+    </a-page-header>
+    <a-card size="small" :bordered="false" class="productInfoEdit-table-page-wrapper">
+      <a-form-model
+        id="productInfoEdit-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="产品名称" prop="name">
+          <a-input
+            id="productInfoEdit-name"
+            :maxLength="30"
+            v-model="form.name"
+            placeholder="请输入产品名称(最多30个字符)"
+            allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="产品编码" prop="code">
+          <a-input
+            id="productInfoEdit-code"
+            :maxLength="30"
+            :disabled="!!$route.params.id"
+            v-model="form.code"
+            placeholder="请输入产品编码(最多30个字符)"
+            allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="原厂编码" prop="origCode">
+          <a-input
+            id="productInfoEdit-origCode"
+            :maxLength="30"
+            :disabled="!!$route.params.id"
+            v-model="form.origCode"
+            placeholder="请输入原厂编码(最多30个字符)"
+            allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="基本单位" prop="unit">
+          <a-input
+            id="productInfoEdit-unit"
+            :maxLength="30"
+            v-model="form.unit"
+            placeholder="请输入基本单位(最多30个字符)"
+            allowClear />
+        </a-form-model-item>
+        <a-form-model-item label="产品品牌" prop="productBrandSn">
+          <a-select
+            id="productInfoEdit-productBrand"
+            placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
+            :disabled="!!$route.params.id"
+            allowClear
+            v-model="form.productBrandSn"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption"
+            style="width: 90%;">
+            <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn" :disabled="item.enabledFlag==0">{{ item.brandName }}</a-select-option>
+          </a-select>
+          <a-button
+            @click="openModal=true"
+            :disabled="!!$route.params.id"
+            icon="plus"
+            size="small"
+            id="productInfoEdit-add-btn"
+            style="margin-left: 5px;"></a-button>
+        </a-form-model-item>
+        <a-form-model-item label="产品分类" prop="productType">
+          <a-cascader
+            :disabled="!!$route.params.id"
+            @change="changeProductType"
+            :options="productTypeList"
+            :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+            id="productInfoEdit-productType"
+            placeholder="请选择产品分类"
+            allowClear
+            v-model="form.productType" />
+        </a-form-model-item>
+        <a-form-model-item label="经销批发价" prop="specialPrice">
+          <a-input-number
+            id="productInfoEdit-specialPrice"
+            v-model="form.specialPrice"
+            :min="0"
+            :max="999999"
+            :precision="2"
+            style="width: 90%;margin-right: 5px;"
+            placeholder="请输入经销批发价(0~999999)"
+            allowClear /><span>元</span>
+        </a-form-model-item>
+        <a-form-model-item label="终端价" prop="terminalPrice">
+          <a-input-number
+            id="productInfoEdit-terminalPrice"
+            v-model="form.terminalPrice"
+            :min="0"
+            :max="999999"
+            :precision="2"
+            style="width: 90%;margin-right: 5px;"
+            placeholder="请输入终端价(0~999999)"
+            allowClear /><span>元</span>
+        </a-form-model-item>
+        <a-form-model-item label="车主价" prop="carOwnersPrice">
+          <a-input-number
+            id="productInfoEdit-carOwnersPrice"
+            v-model="form.carOwnersPrice"
+            :min="0"
+            :max="999999"
+            :precision="2"
+            style="width: 90%;margin-right: 5px;"
+            placeholder="请输入车主价(0~999999)"
+            allowClear /><span>元</span>
+        </a-form-model-item>
+        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+          <a-button type="primary" @click="handleSubmit" size="large" id="productInfoEdit-btn-submit" style="padding: 0 60px;">保存</a-button>
+        </a-form-model-item>
+      </a-form-model>
+      <!-- 新增/编辑产品品牌 -->
+      <product-brand-edit-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    </a-card>
+  </div>
 </template>
 
 <script>
@@ -138,10 +152,10 @@ export default {
         carOwnersPrice: '' //  车主价
       },
       rules: {
-        productName: [
+        name: [
           { required: true, message: '请输入产品名称', trigger: 'blur' }
         ],
-        productCode: [
+        code: [
           { required: true, message: '请输入产品编码', trigger: 'blur' }
         ],
         productBrandSn: [
@@ -175,6 +189,11 @@ export default {
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
+      console.log('productTypeSn3', _this.form.productTypeSn3)
+      if (!this.form.productTypeSn3) {
+        this.$message.warning('产品分类未选到第三级,请修改后再提交!')
+        return
+      }
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
@@ -209,7 +228,7 @@ export default {
       )
     },
     //  返回
-    goBack () {
+    handleBack () {
       this.$router.push({ path: '/productManagement/productInfo/list' })
     },
     //  产品品牌  列表
@@ -246,3 +265,10 @@ export default {
   }
 }
 </script>
+<style lang="less">
+  .productInfoEdit-wrap{
+    .productInfoEdit-back{
+      margin-bottom: 15px;
+    }
+  }
+</style>

+ 9 - 12
src/views/productManagement/productInfo/list.vue

@@ -59,7 +59,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="状态">
-                <v-select code="PRODUCT_STATUS" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
+                <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
               </a-form-item>
             </a-col>
           </template>
@@ -98,12 +98,8 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record">
-        <a-tooltip placement="top">
-          <template slot="title">
-            <span>{{ record.productTypeName }}</span>
-          </template>
-          {{ record.productTypeName3 }}
-        </a-tooltip>
+        <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+        <span v-else>--</span>
       </template>
       <!-- 状态 -->
       <template slot="enabledFlag" slot-scope="text, record">
@@ -117,8 +113,9 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="primary" @click="handleEdit(record)" id="productInfoList-edit-btn">编辑</a-button>
-        <a-button size="small" @click="handleDetail(record)" id="productInfoList-detail-btn" style="margin-left: 15px;">详情</a-button>
+        <a-button size="small" type="link" @click="handleEdit(record)" id="productInfoList-edit-btn">编辑</a-button>
+        <a-divider type="vertical" style="margin: 0;" />
+        <a-button size="small" type="link" @click="handleDetail(record)" id="productInfoList-detail-btn">详情</a-button>
       </template>
     </s-table>
     <!-- 产品详情 -->
@@ -163,7 +160,7 @@ export default {
         { title: '终端价', dataIndex: 'terminalPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
         { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: 140, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 130, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -200,8 +197,8 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.productCode = ''
-      this.queryParam.productName = ''
+      this.queryParam.code = ''
+      this.queryParam.name = ''
       this.queryParam.origCode = ''
       this.queryParam.productBrandSn = undefined
       this.queryParam.productTypeSn1 = ''

+ 235 - 0
src/views/productManagement/productInfoJg/list.vue

@@ -0,0 +1,235 @@
+<template>
+  <a-card size="small" :bordered="false" class="productInfoList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="产品编码">
+              <a-input id="productInfoList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="产品名称">
+              <a-input id="productInfoList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="原厂编码">
+              <a-input id="productInfoList-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
+            </a-form-item>
+          </a-col>
+          <template v-if="advanced">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品品牌">
+                <a-select
+                  placeholder="请选择"
+                  id="productInfoList-productBrandSn"
+                  allowClear
+                  v-model="queryParam.productBrandSn"
+                  :showSearch="true"
+                  option-filter-prop="children"
+                  :filter-option="filterOption">
+                  <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品分类">
+                <a-cascader
+                  @change="changeProductType"
+                  change-on-select
+                  :options="productTypeList"
+                  :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+                  id="productInfoList-productType"
+                  placeholder="请选择产品分类"
+                  allowClear />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="状态">
+                <v-select code="ONLINE_FLAG" id="productInfoList-onlineFalg" v-model="queryParam.onlineFalg" allowClear placeholder="请选择状态"></v-select>
+              </a-form-item>
+            </a-col>
+          </template>
+          <a-col :md="6" :sm="24">
+            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
+            <!-- <a-button
+              style="margin: 0 0 18px 8px"
+              type="danger"
+              @click="handleExport"
+              :disabled="disabled"
+              :loading="exportLoading"
+              id="inventoryQueryList-export">导出</a-button> -->
+            <a @click="advanced=!advanced" style="margin-left: 8px">
+              {{ advanced ? '收起' : '展开' }}
+              <a-icon :type="advanced ? 'up' : 'down'"/>
+            </a>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :scroll="{ x: 1340 }"
+      bordered>
+      <!-- 产品分类 -->
+      <template slot="productType" slot-scope="text, record">
+        <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+        <span v-else>--</span>
+      </template>
+    </s-table>
+  </a-card>
+</template>
+
+<script>
+import moment from 'moment'
+import { productBrandQuery } from '@/api/productBrand'
+import { productTypeQuery } from '@/api/productType'
+import { productList } from '@/api/product'
+import { STable, VSelect } from '@/components'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      advanced: false, // 高级搜索 展开/关闭
+      queryParam: { //  查询条件
+        code: '', //  产品编码
+        name: '', //  产品名称
+        origCode: '', //  原厂编码
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        onlineFalg: undefined, //  状态
+        beginDate: '', //  创建时间  开始时间
+        endDate: '' //  创建时间  结束时间
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false, // 导出loading
+      dateFormat: 'YYYY-MM-DD',
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '产品编码', dataIndex: 'code', width: 140, align: 'center' },
+        { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌', dataIndex: 'productBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 240, align: 'center' },
+        { title: '终端价', dataIndex: 'terminalPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
+        { title: '状态', dataIndex: 'onlineFalgDictValue', width: 140, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return productList(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            const productTypeName1 = data.list[i].productTypeName1 ? data.list[i].productTypeName1 : ''
+            const productTypeName2 = data.list[i].productTypeName2 ? ' > ' + data.list[i].productTypeName2 : ''
+            const productTypeName3 = data.list[i].productTypeName3 ? ' > ' + data.list[i].productTypeName3 : ''
+            data.list[i].productTypeName = productTypeName1 + productTypeName2 + productTypeName3
+          }
+          this.disabled = false
+          return data
+        })
+      },
+      openModal: false, //  查看客户详情  弹框
+      itemId: '', //  当前产品id
+      productBrandList: [], //  品牌下拉数据
+      productTypeList: [] //  分类下拉数据
+    }
+  },
+  methods: {
+    // 不可选日期
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
+    },
+    //  创建时间  change
+    creatTimechange (dates, dateStrings) {
+      this.queryParam.beginDate = dateStrings[0]
+      this.queryParam.endDate = dateStrings[1]
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.code = ''
+      this.queryParam.name = ''
+      this.queryParam.origCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.onlineFalg = undefined
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.$refs.table.refresh(true)
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  导出
+    handleExport () {
+      this.exportLoading = true
+      // dealerProductExport(this.queryParam).then(res => {
+      //   this.exportLoading = false
+      //   this.download(res)
+      // })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '自建产品列表' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      productBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getProductBrand()
+      vm.getProductType()
+    })
+  }
+}
+</script>