author.vue 4.17 KB
<template>
  <div class="contentBox">
    <div class="content">
      <div class="headerbox">
        <span class="addbox">
          <el-button type="primary" @click="addAuthor">添加授权</el-button>
        </span>
      </div>
      <div class="mt10">
        <el-table
          height="574"
          :data="tableData"
          stripe
          border
          style="width: 100%"
        >
          <el-table-column
            type="index"
            align="center"
            label="#"
            width="40"
          ></el-table-column>
          <el-table-column align="center" prop="code_unid" label="模板名称">
          </el-table-column>
          <el-table-column prop="code" align="center" label="授权路数">
          </el-table-column>
          <el-table-column align="center" prop="name" label="已使用路数">
          </el-table-column>
          <el-table-column align="center" prop="name" label="备注">
          </el-table-column>
          <el-table-column align="center" prop="operation" label="操作">
            <template slot-scope="scope">
              <el-tooltip
                content="详情"
                placement="bottom"
                effect="light"
                :visible-arrow="false"
              >
                <span
                  class="iconfont el-icon-info"
                  @click="showDetail(scope.$index, scope.row)"
                ></span>
              </el-tooltip>
            </template>
          </el-table-column>
        </el-table>
        <div style="margin-top: 28px;">
          <el-pagination
            style="float: right;"
            background
            prev-text="上一页"
            next-text="下一页"
            :page-sizes="[20, 30, 50, 100, 200]"
            layout="total, prev, pager, next,sizes, jumper"
            :current-page="page"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :total="total"
          >
          </el-pagination>
          <div style="clear: both;"></div>
        </div>
      </div>
    </div>
    <el-dialog title="上传授权文件" :visible.sync="detailVisible" width="400px">
      <el-upload
        class="upload-demo"
        ref="upload"
        action="https://jsonplaceholder.typicode.com/posts/"
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :file-list="fileList"
        :auto-upload="false"
      >
        <el-button slot="trigger" size="small" type="primary"
          >选取文件</el-button
        >
        <el-button
          style="margin-left: 10px;"
          size="small"
          type="success"
          @click="submitUpload"
          >上传到服务器</el-button
        >
        <div slot="tip" class="el-upload__tip">
          只能上传jpg/png文件,且不超过500kb
        </div>
      </el-upload>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="detailVisible = false">取 消</el-button>
        <el-button size="small" type="primary" @click="saveCode"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <div>
      <authordetail ref="detail"></authordetail>
    </div>
  </div>
</template>
<script>
import authordetail from "./authorDetail";
export default {
  data() {
    return {
      detailData: [],
      total: 0,
      page: 1,
      curCateUnid: "",
      pageSize: 20,
      tableData: [],
      catesData: [],
      selectDevs: "",
      detailVisible: false,
      codeStatus: 0,
      codeData: {}
    };
  },
  components: {
    authordetail
  },
  created() {
  },
  methods: {
    submitUpload() {
      this.$refs.upload.submit();
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    showDetail(index, row) {
      this.$refs.detail.initahthor(row);
    },
    addAuthor() {
      this.codeStatus = 0;
      this.detailVisible = true;
    },
    handleSizeChange(val) {
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      this.page = val;
    }
  }
};
</script>
<style lang="scss" scoped>
.headerbox {
  overflow: hidden;
}
.addbox {
  float: right;
  margin-right: 10px;
}
</style>