<template>
  <div class="page">
    <LayoutTable :data="tableData" :config="tableConfig"> </LayoutTable>

    <drawer-show ref="drawerform" @ok="getData" />
  </div>
</template>

<script>
/** 表单弹出框模式需引入 */
import drawerShow from "./drawershow";
import table from "@/assets/mixins/table";
export default {
  name: "PerformErrorRecordList",
  components: {
    drawerShow,
  },
  mixins: [table],
  created() {},
  methods: {
    /** 重写新增方法 */
    toAdd(row) {
      this.$refs.drawerform.add(row);
    },
    /** 重写编辑方法 */
    toEdit(row) {
      this.$refs.drawerform.edit(row);
    },
    /** 重写查看方法 */
    toView(row) {
      this.$refs.drawerform.view(row);
    },
  },
  data() {
    return {
      config: {
        search: [
          {
            name: "staffName",
            type: "text",
            label: "员工姓名",
            fuzzy: true,
          },
          {
            name: "workNum",
            type: "text",
            label: "工号",
            fuzzy: true,
          },
          {
            name: "windowNum",
            type: "text",
            label: "窗口编号",
            fuzzy: true,
          },
          {
            name: "deptName",
            type: "text",
            label: "所属部门名称",
            fuzzy: true,
          },
          {
            name: "irregularType",
            type: "select",
            label: "违规类型",
            fuzzy: true,
          },
          {
            name: "happenTime",
            type: "date",
            label: "发生时间",
            fuzzy: true,
          },
          {
            name: "duration",
            type: "text",
            label: "持续时间，秒",
            fuzzy: true,
          },
          {
            name: "ruleName",
            type: "text",
            label: "规则名称",
            fuzzy: true,
          },
          {
            name: "deductPerson",
            type: "text",
            label: "扣分人员",
            fuzzy: true,
          },
          {
            name: "score",
            type: "text",
            label: "扣分或增加分值",
            fuzzy: true,
          },
        ],
        columns: [
          { type: "selection", width: 60 },
          { type: "index", label: "序号", width: 50 },

          { label: "员工姓名", prop: "staffName" },

          { label: "工号", prop: "workNum" },

          { label: "窗口编号", prop: "windowNum" },

          { label: "所属部门", prop: "deptId", formatter: this.formatter },

          { label: "所属部门名称", prop: "deptName" },

          {
            label: "违规类型",
            prop: "irregularType",
            formatter: this.formatter,
          },

          {
            label: "发生时间",
            prop: "happenTime",
            formatter: this.formatterDate,
          },

          {
            label: "持续时间，秒",
            prop: "duration",
            formatter: this.formatter,
          },

          {
            label: "报警时间",
            prop: "alarmTime",
            formatter: this.formatterDate,
          },

          { label: "图片凭证地址", prop: "snapPath" },

          { label: "规则名称", prop: "categoryName" },

          { label: "绩效规则id", prop: "ruleId", formatter: this.formatter },

          { label: "规则名称", prop: "ruleName" },

          { label: "扣分方式", prop: "subMethod", formatter: this.formatter },

          { label: "扣分人员", prop: "deductPerson" },

          {
            label: "扣分时间",
            prop: "deductTime",
            formatter: this.formatterDate,
          },

          { label: "增减类型", prop: "subAddType", formatter: this.formatter },

          { label: "扣分或增加分值", prop: "score", formatter: this.formatter },

          {
            label: "处理状态",
            prop: "processStatus",
            formatter: this.formatter,
          },

          {
            label: "创建用户",
            prop: "createUserId",
            formatter: this.formatter,
          },
          {
            label: "操作",
            width: 240,
            formatter: (row) => {
              return (
                <table-buttons
                  noAdd
                  row={row}
                  onEdit={this.toEdit}
                  onView={this.toView}
                  onDel={this.toDel}
                />
              );
            },
          },
        ],
      },
    };
  },
};
</script>
