<template>
  <template-page ref="pageRef" :get-list="getList" :column-parsing="columnParsing" :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 { loginOrderRecycleList, loginOrderRecycleDel, loginOrderRecycleRestore } from "@/api/lajizhan"
export default {
  components: { TemplatePage },
  mixins: [import_mixin],
  data() {
    return {
      visible: false,
      // 事件组合
      optionsEvensGroup: [
      ],
      // 表格属性
      tableAttributes: {
        // 启用勾选列
        selectColumn: true
      }, // 关闭新增弹窗
      // 表格事件
      tableEvents: {
        'selection-change': this.selectionChange
      },
      recordSelected: []
    }
  },
  methods: {
    // 列表请求函数
    getList: loginOrderRecycleList,
    // 表格列解析渲染数据更改
    columnParsing(item, defaultData) {
      return defaultData
    },
    // 监听勾选变化
    selectionChange(data) {
      this.recordSelected = data
    },
    operation(h, { row, index, column }) {
      return <div class='operation-btns'>
        <el-popconfirm
          onConfirm={() => {
            loginOrderRecycleRestore([row.id]).then(res => {
              this.$refs.pageRef.refreshList()
            })
          }}
          title="是否恢复？"
        >
          <el-button type="text" size="mini" slot="reference">恢复</el-button>
        </el-popconfirm>
        <el-popconfirm
          onConfirm={() => {
            loginOrderRecycleDel([row.id]).then(res => {
              this.$refs.pageRef.refreshList()
            })
          }}
          title="是否确定删除？"
        >
          <el-button type="text" size="mini" slot="reference">删除</el-button>
        </el-popconfirm>
      </div>
    },
    handleClose() {
      this.addOff(() => {
        this.visible = false
      })()
    }
  }
}
</script>

<style lang="scss" scoped>
  ::v-deep .zj-button-collection{
    min-height: 54px !important;
  }
</style>
