{
    template:'${tmpl}',
    data:function(){
      
        return {
          exportExcelUrl:"",
          d:{},
          action:"",
          tmExcelUrl:"",
          loading:false,
        }
    },
    mounted:function(){
      var that=this;
      this.$root.postReq("/web/uploadCtl/getOssConfig","").then(function(d){
        that.d["key"]="key";
        that.d["Bucket"]=d.Bucket;
        that.d["OSSAccessKeyId"]=d.OSSAccessKeyId;
        that.d["Signature"]=d.Signature;
        that.d["policy"]=d.policy;
        that.d["success_action_status"]=d.success_action_status;
        that.action=d.url;
    });
    },
    created:function(){

    },
    methods:{
      setKey(name,flag){
        var myDate = new Date();
        var key = "zc_sbjy"+Math.round(Math.random()*10000)+myDate.getMonth()+myDate.getTime()+myDate.getFullYear()+myDate.getDate()+myDate.getHours()+myDate.getMinutes()+myDate.getSeconds()+myDate.getMilliseconds()+".xlsx";
        console.log(this.$refs[flag]);
        this.$refs[flag].d.key = key;
      },
      
      uploadsuccess(obj){
        var that = this;
        that.loading = true;
        this.tmExcelUrl=obj.result;
        setTimeout(() => {
          that.loading = false;
        }, 1000);
        return
      },
      error(err){
        this.$message.warning(`上传失败，请重新上传`);
        console.log(err);
      },
      toList(){
        this.$root.pushx({
          title:"商标交易库",
          name:"/mytmtransaction"
         });
         return;
      },
      publish(){
        var that = this;
        if(this.tmExcelUrl){
          this.$root.showMask();
          var arr = this.tmExcelUrl.split("gsb-zc.oss-cn-beijing.aliyuncs.com//");
          if(arr.length==2){
            this.$root.postReq("/web/trademarktransactionCtl/excelCreate",{srckey:arr[1]}).then(d=>{
              if(d && d.code==1){
                that.exportExcelUrl=d.exportExcelUrl;
                /**
                 * that.$message.success("发布完成，共发布"+d.sum+"个商标，成功"+d.successCount+"个，失败"+d.errorCount+"个");
                 */
                this.$message({
                  message: "发布完成，共发布"+d.sum+"个商标，成功"+d.successCount+"个，失败"+d.errorCount+"个",
                  type: 'success',
                  duration:10000,
                  showClose: true
                });
              }else{
                that.$message.warning(d.msg);
              }
              that.$root.hideMask();
            }).catch(e=>{
              that.$root.hideMask();
            });
          }
        }
      }
    },
    computed: Vuex.mapState({
      count:state=>state.count,
      headStyle:function(){
        return {"background-color":"white"};
      }
    }),
    vname:"gsb_tmtransactionbatchrelease"
}
