<template>
  <span>
    <el-button
      v-if="!noEdit"
      type="text"
      icon="el-icon-edit"
      size="mini"
      @click="$emit('edit', row)"
      title="编辑"
      style="margin-left: 0;margin-right: 5px"
      >编辑</el-button
    >
    <el-button
      v-if="noAuth"
      type="text"
      icon="el-icon-edit"
      size="mini"
      @click="$emit('edit', row)"
      title="考核授权"
      style="margin-left: 0;margin-right: 5px"
      >考核授权</el-button
    >
    <el-button
      v-if="!noView"
      type="text"
      icon="el-icon-view"
      size="mini"
      @click="$emit('view', row)"
      title="查看"
      style="margin-left: 0;margin-right: 5px"
      >查看</el-button
    >
    <el-switch
      v-if="switchBtn"
      v-model="row.check"
      @change="$emit('view', row)"
      title="核查"
      :active-value="true"
      style="margin-left: 0;margin-right: 5px"
      :inactive-value="false"
    ></el-switch>
    <el-button
      v-if="reCheck"
      type="text"
      icon="el-icon-edit"
      size="mini"
      @click="$emit('edit', row)"
      title="核查"
      style="margin-left: 0;margin-right: 5px"
      >{{ text ? text : "核查" }}</el-button
    >
    <el-button
      v-if="chuli"
      type="text"
      icon="el-icon-edit"
      size="mini"
      @click="$emit('edit', row)"
      title="处理"
      style="margin-left: 0;margin-right: 5px"
      >处理</el-button
    >
    <Confirm @confirm="$emit('del', row.id)" message="确定要删除该条记录吗？">
      <el-button
        v-if="!noDel"
        type="text"
        icon="el-icon-delete"
        size="mini"
        title="删除"
        style="margin-left: 0;margin-right: 5px;color: #FA4D4C;"
        >删除</el-button
      >
    </Confirm>
  </span>
</template>

<script>
import Confirm from "@/components/Confirm.vue";
export default {
  props: {
    noEdit: {
      type: Boolean,
      default: false,
    },
    noDel: {
      type: Boolean,
      default: false,
    },
    noAdd: {
      type: Boolean,
      default: false,
    },
    noAuth: {
      type: Boolean,
      default: false,
    },
    reCheck: {
      type: Boolean,
      default: false,
    },
    chuli: {
      type: Boolean,
      default: false,
    },
    switchBtn: {
      type: Boolean,
      default: false,
    },
    noView: {
      type: Boolean,
      default: false,
    },
    row: {
      type: Object,
      required: true,
      default: () => {},
    },
    text: {
      type: String,
      default: "",
    },
  },
  components: {
    Confirm,
  },
  methods: {},
  data() {
    return {};
  },
};
</script>
