<template>
  <template-page
    ref="pageRef"
    :get-list="getList"
    :table-attributes="tableAttributes"
    :table-events="tableEvents"
    :options-evens-group="optionsEvensGroup"
    :operation="operation()"
  >
  </template-page>
</template>

<script>
import TemplatePage from "@/components/template/template-page-1.vue";
import import_mixin from "@/components/template/import_mixin.js";
import operation_mixin from "@/components/template/operation_mixin.js";
import { supplementList } from "@/api/subsidyApplication";
export default {
  components: { TemplatePage },
  mixins: [import_mixin, operation_mixin],
  data() {
    return {
      // 表格属性
      tableAttributes: {
        // 启用勾选列
        selectColumn: false,
      },
      // 表格事件
      tableEvents: {
        "selection-change": this.selectionChange,
      },
      // 勾选选中行
      recordSelected: [],
    };
  },
  computed: {
    // 事件组合
    optionsEvensGroup() {
      return [];
    },
    // 更多参数
    moreParameters() {
      return [];
    },
  },
  methods: {
    // 列表请求函数
    getList: supplementList,
    // 列表导出函数
    selectionChange(data) {
      this.recordSelected = data;
    },
    // 操作按钮
    operation() {
      return this.operationBtn({
        details: {
          click: ({ row, index, column }) => {
            let { href } = this.$router.resolve({
              path: `/order/subsidyApplication_children/subsidyApplicationDetail?id=${row.id}&type=details`,
            });
            window.open(href, "_blank");
          },
        },
        edit: {
          conditions: ({ row, index, column }) => {
            return ["SAVE"].includes(row.status);
          },
          click: ({ row, index, column }) => {
            let { href } = this.$router.resolve({
              path: `/order/subsidyApplication_children/subsidyApplicationDetail?id=${row.id}&type=edit`,
            });
            window.open(href, "_blank");
          },
        },
        reiterate: {
          conditions: ({ row, index, column }) => {
            return (
              ["D3", "E3"].includes(row.checkStatus) ||
              [2, "2"].includes(row.traceStatus)
            );
          },
          click: ({ row, index, column }) => {
            let { href } = this.$router.resolve({
              path: `/order/subsidyApplication_children/subsidyApplicationDetail?id=${row.id}&type=reiterate`,
            });
            window.open(href, "_blank");
          },
        },
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
