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

<script>
import table from "@/assets/mixins/table";

export default {
  mixins: [table],
  created() {
    this.config.addQuery = { matterId: this.$route.query["query.matterId"] };

  },
  data() {
    return {
      config: {
        columns: [
          { label: "事项名称", prop: "matterName",tooltip:true },
          { label: "问题", prop: "title" },
          { label: "回答", prop: "content" },
          { label: "常见问题来源", prop: "source", formatter: this.formatter },

          {
            label: "操作",
            width: 180,
            formatter: (row) => {
              return (
                <div>
                  <el-button
                    type="primary"
                    icon="el-icon-edit"
                    round
                    size="mini"
                    onClick={() => {
                      this.toEdit(row);
                    }}
                  >
                    编辑
                  </el-button>
                  {row.source == 1 ? (
                    <Confirm
                      onConfirm={() => {
                        this.toDel(row.id, 0);
                      }}
                      message="是否删除当前常见问题？"
                    >
                      <span>&nbsp;&nbsp;</span>
                      <el-button
                        size="mini"
                        type="warning"
                        icon="el-icon-delete"
                       round
                        title="删除"
                      >删除</el-button>{" "}
                    </Confirm>
                  ) : (
                    ""
                  )}
                </div>
              );
            },
          },
        ],
      },
    };
  },
};
</script>