Browse Source

bug修复

chenrui 3 năm trước cách đây
mục cha
commit
e306d8de58

+ 2 - 2
src/config/router.config.js

@@ -50,7 +50,7 @@ export const asyncRouterMap = [
       },
       // 新品列表
       {
-        path: '/newProduct',
+        path: '/newProduct/:onlineFalg',
         name: 'newProduct',
         component: () => import(/* webpackChunkName: "home" */ '@/views/productManagement/newProduct/list'),
         meta: {
@@ -1807,7 +1807,7 @@ export const asyncRouterMap = [
                 }
               }
             ]
-          },
+          }
         ]
       },
       //  供应商管理

+ 11 - 2
src/layouts/BasicLayout.vue

@@ -46,11 +46,12 @@
       </a-layout-content>
       <!-- 视频播放弹窗 -->
       <a-modal
-        v-model="isShowVideo"
+        v-model="isShowVideoVal"
         wrapClassName="vidio_cont"
         :footer="null"
         centered
-        destroyOnClose
+        :maskClosable="false"
+        :destroyOnClose="true"
         :width="1000"
         @cancel="closeVido">
         <video-player
@@ -116,6 +117,14 @@ export default {
       fixedHeader: state => state.app.fixedHeader
     }),
     ...mapGetters(['nowRoute', 'isShowVideo']),
+    isShowVideoVal: {
+      get () {
+        return this.$store.state.app.isShowVideo
+      },
+      set (newValue) {
+        this.$store.state.app.isShowVideo = newValue
+      }
+    },
     contentPaddingLeft () {
       if (!this.fixSidebar || this.isMobile()) {
         return '0'

+ 30 - 8
src/views/Home.vue

@@ -18,15 +18,15 @@
     <!-- 新产品上线提醒 -->
     <a-modal
       class="newProductTips"
-      title="新产品上线提醒"
-      width="60%"
+      :title="'新产品'+(onlineFalg=='1'?'':'下')+'线提醒'"
+      :width="800"
       centered
       :footer="null"
       :maskClosable="false"
       :destroyOnClose="true"
-      @cancel="openNewProduct=false"
+      @cancel="cancelProductTips"
       v-model="openNewProduct">
-      <newProduct @close="openNewProduct=false"></newProduct>
+      <newProduct :onlineFalg="onlineFalg" @seeMore="seeMore"></newProduct>
     </a-modal>
   </div>
 </template>
@@ -43,7 +43,8 @@ export default {
     return {
       message: '欢迎登录' + process.env.VUE_APP_PRO_NAME,
       openResetPwd: false, //  重置密码是否显示
-      openNewProduct: false
+      openNewProduct: false,
+      onlineFalg: '1' // 上下线标识  1为上线,0为下线
     }
   },
   computed: {
@@ -53,11 +54,32 @@ export default {
   },
   methods: {
     hasNewProduct () {
-      queryNewProductPage({ pageNo: 1, pageSize: 20 }).then(res => {
-        if (res.status == 200 && res.data.count > 0) {
-          this.openNewProduct = true
+      queryNewProductPage({ pageNo: 1, pageSize: 20, onlineFalg: this.onlineFalg }).then(res => {
+        if (res.status == 200) {
+          if (res.data.count > 0) {
+            this.openNewProduct = true
+          } else {
+            if (this.onlineFalg == '1') {
+              this.onlineFalg = '0'
+              this.hasNewProduct()
+            }
+          }
         }
       })
+    },
+    // 查看更多产品
+    seeMore () {
+      this.openNewProduct = false
+      this.$router.push({ name: 'newProduct', params: { onlineFalg: this.onlineFalg } })
+    },
+    // 关闭弹框
+    cancelProductTips () {
+      const _this = this
+      this.openNewProduct = false
+      if (this.onlineFalg == '1') {
+        this.onlineFalg = '0'
+        setTimeout(() => { _this.openNewProduct = true }, 100)
+      }
     }
   },
   beforeRouteEnter (to, from, next) {

+ 3 - 3
src/views/bulkManagement/bulkWarehousingOrder/list.vue

@@ -58,9 +58,9 @@
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkWarehousingOrderList-refresh">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="bulkWarehousingOrderList-reset">重置</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="bulkWarehousingOrderList-reset">重置</a-button>
                 <a-button
-                  style="margin-left: 8px"
+                  style="margin-left: 5px"
                   type="primary"
                   class="button-warning"
                   @click="handleExport"
@@ -68,7 +68,7 @@
                   :loading="exportLoading"
                   v-if="$hasPermissions('B_bulkWarehousingOrder_export')"
                   id="bulkWarehousingOrderList-export">导出</a-button>
-                <a @click="advanced=!advanced" style="margin-left: 8px">
+                <a @click="advanced=!advanced" style="margin-left: 5px">
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'"/>
                 </a>

+ 17 - 50
src/views/productManagement/newProduct/list.vue

@@ -38,12 +38,12 @@
                   allowClear />
               </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>
             <template v-if="advanced">
+              <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-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
@@ -58,13 +58,6 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @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="newProduct-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -82,7 +75,8 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ x: 1300, y: tableHeight }"
+        :defaultLoadData="false"
+        :scroll="{ x: 1090, y: tableHeight }"
         bordered>
         <!-- 产品分类 -->
         <template slot="productType" slot-scope="text, record">
@@ -104,10 +98,8 @@
 </template>
 
 <script>
-import moment from 'moment'
 import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
-// import { dealerProductList, dealerProductExport } from '@/api/dealerProduct'
 import { queryNewProductPage } from '@/api/product'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
@@ -136,36 +128,32 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
       columns: [
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
         { title: '上线日期', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 200, align: 'center' },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: 140, align: 'center' },
         { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'code', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单位', dataIndex: 'unit', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'origCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
+        { title: '产品编码', dataIndex: 'code', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return queryNewProductPage(Object.assign(parameter, this.queryParam)).then(res => {
+        return queryNewProductPage(Object.assign(parameter, this.queryParam, { onlineFalg: this.$route.params.onlineFalg })).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
           this.spinning = false
           return data
         })
       },
-      openModal: false, //  查看客户详情  弹框
+      openModal: false, //  查看详情  弹框
       itemId: '', //  当前产品productSn
       productBrandList: [], //  品牌下拉数据
       productTypeList: [] //  分类下拉数据
@@ -207,28 +195,6 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
-    //  导出
-    handleExport () {
-      this.exportLoading = true
-      this.spinning = true
-      dealerProductExport(this.queryParam).then(res => {
-        this.exportLoading = false
-        this.download(res)
-        this.spinning = false
-      })
-    },
-    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 () {
       dealerProductBrandQuery({}).then(res => {
@@ -251,7 +217,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 235
+      this.tableHeight = window.innerHeight - tableSearchH - 215
     }
   },
   mounted () {
@@ -270,6 +236,7 @@ export default {
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
+      vm.$refs.table.refresh(true)
       vm.getProductBrand()
       vm.getProductType()
     })

+ 57 - 29
src/views/productManagement/newProduct/modal.vue

@@ -1,20 +1,23 @@
 <template>
   <div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable fixPagination"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :scroll="{ y: 400 }"
-      :data="loadData"
-      :showPagination="false"
-      bordered>
-    </s-table>
-    <div style="padding-top: 15px;">
-      <a-button @click="viewMore" block type="primary" ghost>查看更多新品</a-button>
-    </div>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :scroll="{ y: 400 }"
+        :data="loadData"
+        :defaultLoadData="false"
+        :showPagination="false"
+        bordered>
+      </s-table>
+      <div style="padding-top: 15px;">
+        <a-button @click="viewMore" block type="primary" ghost>查看更多新品</a-button>
+      </div>
+    </a-spin>
   </div>
 </template>
 
@@ -24,38 +27,63 @@ import { queryNewProductPage } from '@/api/product'
 export default {
   name: 'NewProduct',
   components: { STable },
+  props: {
+    onlineFalg: { // 上下线标识  1为上线,0为下线
+      type: [ String, Number ],
+      default: '1'
+    }
+  },
   data () {
     return {
+      spinning: false,
       queryParam: {},
-      columns: [
-        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'code', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '单位', dataIndex: 'unit', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '上线时间', dataIndex: 'createDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } }
-      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return queryNewProductPage(Object.assign(parameter, this.queryParam)).then(res => {
+        this.spinning = true
+        return queryNewProductPage(Object.assign(parameter, this.queryParam, { onlineFalg: this.onlineFalg })).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
           }
+          this.spinning = false
           return data
         })
       }
     }
   },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: 50, align: 'center' },
+        { title: '产品品牌', dataIndex: 'productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'code', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      if (this.onlineFalg == '1') {
+        arr.push({ title: '上线时间', dataIndex: 'onlineAuditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } })
+      } else if (this.onlineFalg == '0') {
+        arr.push({ title: '下线时间', dataIndex: 'offlineAuditTime', width: 140, align: 'center', customRender: function (text) { return text || '--' } })
+      }
+      return arr
+    }
+  },
   methods: {
     viewMore () {
-      this.$router.push({ name: 'newProduct' })
-      this.$emit('close')
+      this.$emit('seeMore')
+    }
+  },
+  mounted () {
+    this.$refs.table.refresh(true)
+  },
+  watch: {
+    onlineFalg (newValue, oldValue) {
+      const _this = this
+      setTimeout(() => {
+        _this.$refs.table.refresh(true)
+      }, 400)
     }
   }
 }
 </script>
-
-<style>
-</style>