复用哒小功能

1.上传文件 代码

    <div class="common-table-layout divInstant">

     <div class="left must">

        证书名称:

     </div>

     <div class="right">

      <el-input class="input-style-300px" v-model="fileName" disabled   clearable  placeholder="请点击上传证书按钮"></el-input>

      <form @click="importFile"  id="upload-form" enctype="multipart/form-data"  style="position:relative; display:inline;">

        <button class="button button-primary button-rounded button-small" style="cursor: pointer;" :disabled="!importStatus">

         <i class="fa fa-upload"></i>

           上传证书

        </button>

        <input

          @change="importFileChange"

          :disabled="!importStatus"

          ref="importFile"

          type="file"

          name="file"

          accept=".pem, .key"

          class="position-center inline-block el-input-file"

          style="width: 100%;display: none;"

        >

      </form>

      <span class="config-tips">

        <i class="fa fa-info-circle"></i>

         证书文件的格式仅支持 .pem 与 .key

      </span>

     </div>

    </div>

-----------------------------------------------------------------------------------------------

    importFile() {

      this.$refs.importFile.click();

    },

    importFileChange(val) {

      this.importStatus = false;

      const file = new FormData();

      file.append('file', val.target.files[0]);

      const userToken = this.$store.getters.userInfo === '' ? '' : this.$store.getters.userInfo.token;

      $.ajax({

        url: process.env.BASE_API + '/fast/https/uploadCert' + '?user_token=' + userToken,

        type: 'POST',

        cache: false,

        processData: false,

        contentType: false,

        data: file,

        success: (response) => {

          this.importStatus = true;

          if (response.status) {

            this.fileName = val.target.files[0].name;

            this.filePath = response.data.filePath;

            this.$refs.importFile.value = '';

          } else {

            layerMsg.msg(response.message, 0, '');

            this.importStatus = true;

            this.$refs.importFile.value = '';

          }

        },

        error: (err) => {

          layerMsg.msg(err.message, 0, '');

          this.importStatus = true;

          this.$refs.importFile.value = '';

        }

      });

    },

2.table序号(1,2,3,4,5)

 <el-table-column label="序号" type="index" :index="getTableOrder" width="80" ></el-table-column>

----------------------------------------------------------------------------------------------------------------------------

    getTableOrder(index) {

      return index + (this.pageNum - 1) * this.pageSize + 1;

    },

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值