美文网首页
本地存储5分钟在点击提示

本地存储5分钟在点击提示

作者: 阳光之城alt | 来源:发表于2018-08-03 17:19 被阅读0次
    image.png
    <template>
         <div>
              <span class="btns" title="导出"  @click="downLoadFile"></span>
         </div>
    </template>
    
    <script>
    import { mapState, mapActions } from "vuex";
    
    export default {
      mounted() {
        scrollBox.init("booking_order", this.$store);
      },
      data() {
        return {
          deliveryVal: 0,
         downLoadFileFlag:true,
          url: "",
          hostUrl: config.hostUrl,
          shipMentOrderList: [],
          permission: {},
          num: 0,
          code: 0,
          so: 0,
          status:0,
          loading_date: '',
          forwarder: 0,
          query: {},
          permission:{},
          addSellList: [],
          searchDatas: {
          
        };
      },
      created() {
        // var _this = this;
        // var obj = {
        //     orderType: 'feeding-order',
        //     pagenum: _this.pageAAA,
        //     pagecounts: _this.page_countaaa,
        // };
        // this.$store.dispatch('getListData',obj);
      },
      watch: {
    
      },
      computed: {
        ...mapState({
          headers: state => state.headers,
          changeFlages: state => state.changeFlages,
          searchData: state => state.shipment.searchData
        })
      },
      methods: {
            downLoadFile() { //点击事件
                    let shipmentPageExportIssueTime = localStorage.getItem('shipmentPageExportIssueTime')
                    if ( shipmentPageExportIssueTime && (new Date().getTime() - Number(shipmentPageExportIssueTime) > 0)) {
                    localStorage.removeItem('shipmentPageExportIssueTime')
                    shipmentPageExportIssueTime = null
                    }
                    if (!shipmentPageExportIssueTime) {
                    let url = this.hostUrl+`/cn/new/landing-order/export?&code=${this.searchData.code}&customer=${this.searchData.customer}&forwarder=${this.searchData.forwarder}&cports=${this.searchData.cports}&mports=${this.searchData.mports}&status=${this.searchData.status}&so=${this.searchData.so}&factory=${this.searchData.factory}&cabinet=${this.searchData.cabinet}&date=${this.searchData.date}&endDate=${this.searchData.endDate}+$ty`;
                    window.open(url);
                    localStorage.setItem('shipmentPageExportIssueTime', (new Date().getTime() + 1000 * 60 * 5).toString())
                    } else {
                    let minus = ((Number(shipmentPageExportIssueTime) - new Date().getTime()) / 1000 /60).toFixed(0)
                    if(minus==0){
                    minus=1;
                    }
                    var obj = {
                    title: '请求已发送,请'+minus+'分钟以后再操作',
                    flag: true,
                    type: 3,
                    btnGroup:['ok']
                    };
                    this.$store.commit('popup',obj);
                    }
                },
        
     
       
    

    相关文章

      网友评论

          本文标题:本地存储5分钟在点击提示

          本文链接:https://www.haomeiwen.com/subject/ukruvftx.html