<template>
  <div class="execution">
    <Card style="margin-bottom: 5px">
      <p>
        <el-button
          type="primary"
          @click="backPage"
          style="margin-left: 20px; margin-right: 50px"
          >返回</el-button
        >
      </p>
    </Card>

    <basic-container>
      <!--
								:permission="permissionList"
						 -->
      <avue-crud
        ref="crud"
        :page="page"
        :data="tableData"
        :table-loading="tableLoading"
        :option="tableOption"
        @on-load="getList"
        @refresh-change="refreshChange"
        @size-change="sizeChange"
        @current-change="currentChange"
      >
        <template slot="menu" slot-scope="scope">
          <el-button
            type="text"
            size="small"
            icon="el-icon-check"
            @click="detailLook(scope.row, scope.index)"
            >查看
          </el-button>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
import { getExportPackageZbTaskList } from "@/api/wmtask";
import { reportExportlook } from "@/const/crud/export";
import Config from "@/settings";
export default {
  name: "wmtaskrule",
  data() {
    return {
      searchForm: {},
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 20 // 每页显示多少条
      },
      tableLoading: false,
      tableOption: reportExportlook,
      tableData: []
    };
  },
  computed: {},
  mounted() {},
  methods: {
    getList(page, params) {
      getExportPackageZbTaskList(
        Object.assign(
          {
            current: page.currentPage,
            size: page.pageSize,
            scorePackageId: this.$route.query.id
          },
          params,
          this.searchForm
        )
      )
        .then(response => {
          this.tableData = response.data.data.records;
          this.page.total = response.data.data.total;
          this.tableLoading = false;
        })
        .catch(() => {
          this.tableLoading = false;
        });
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    currentChange(current) {
      this.page.currentPage = current;
    },
    refreshChange() {
      this.getList(this.page);
    },
    backPage() {
      this.$router.$avueRouter.closeTag();
      this.$router.back();
    },
    // 查看
    detailLook(row, index) {
      window.open(
        Config.outsideUrl + "/h5/#/pages/task/task-detail/index?id=" + row.id,
        "newwindow",
        "height=500, width=400, top=200, left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
      );
    }
  }
};
</script>
