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

        <!-- <dialog-show ref="dialogform" @ok="getData" /> -->

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

<script>
    /** 表单弹出框模式需引入 */
   import drawerShow from "./drawershow";
    import table from "@/assets/mixins/table";
    export default {
        name: "AlarmConfig",
        components: {drawerShow },
        mixins: [table],
        created() {
        },
        methods: {

            /** 重写新增方法 */
            toAdd(row) {
                //this.$refs.dialogform.add(row);

                 this.$refs.drawerform.add(row);
            },
            /** 重写编辑方法 */
            toEdit(row) {
                this.$refs.drawerform.edit(row);

            },
            /** 重写查看方法 */
            // toView(row) {
            //     this.$refs.dialogform.view(row);
            // },
             // 操作菜单状态
    changeStatus(row, column) {
      return (
        <device-switch
          confirm
          url="/alarm/config/save"
          row={row}
          onChange={this.statusChange}
          value={this.tableData.data}
          onInput={(data) => {
            this.tableData.data = data;
          }}
        />
      );
    },

        },
        data() {
            return {
                config: {
                    search: [
                    ],
                    columns: [
                        {type: "selection", width: 60},

                        {label: "序号",type: "index", width: 60},
     {label: "告警内容", prop: "alarmType",formatter: this.formatter},
                        {label: "设备类型", prop: "productId", formatter: this.formatterString},

                        {label: "告警级别", prop: "alarmLevel",formatter: this.formatter},
                           {label: "推送方式", prop: "alarmPusW1ay",formatter: this.formatter},
 {label: "备注", prop: "remark"},

 {label: "创建时间", prop: "createTime",formatter:this.formatterDate},
                   
 {label: "更新时间", prop: "updateTime",formatter:this.formatterDate},
                         {
            prop: "enabled",
            label: "启用/停用",
            width: 100,
            formatter: this.changeStatus,
          },

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