<template>
  <el-dialog title="当前附件审查流程列表" :close-on-click-modal="false" :visible.sync="visible" custom-class="uploadViewReview" width="40%" append-to-body>
    <el-row>
      <el-col :span="24">
        <el-table :data="list">
          <el-table-column prop="reviewDate" label="流程发起日期"></el-table-column>
          <el-table-column>
            <template slot-scope="scope">
              <el-button size="mini" @click="clickHandle(scope.row)">查看审查流程</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>

    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: "ViewReview",
  data() {
    return {
      visible: false,
      list: [],
    };
  },
  inject: ["upload"],
  methods: {
    init() {
      this.visible = true;
      this.getUploadReviewList();
    },
    clickHandle(data) {
      this.$router.openTaskWindow({
        formId: data.id,
        flowCode: "fileReview",
      });
      this.visible = false;
    },
    getUploadReviewList() {
      this.$http({
        url: this.$http.adornUrl("/fileserver/fileInfo/getUploadedReviewFile", false),
        method: "get",
        params: {
          uploadFormId: this.upload.formId,
        },
      }).then(({ data }) => {
        if (data.code === 40000) {
          this.list = data.FileInfoList;
        } else {
          this.$alert(data.msg, "错误提示", {
            confirmButtonText: "确定",
          });
        }
      });
    },
  },
};
</script>

<style lang="scss">
.uploadViewReview {
  .el-dialog__body {
    max-height: 500px;
    overflow-y: auto;
  }
}
</style>
