<template>
  <div class="app-container">
    <!--用户数据-->
    <el-col :span="24" :xs="24">
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        v-show="showSearch"
        label-width="68px"
      >
        <el-form-item label="" prop="userName">
          <el-input
            v-model="queryParams.userName"
            placeholder="请输入角色名称"
            clearable
            size="small"
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >清空</el-button
          >
        </el-form-item>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="mini"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['system:user:remove']"
            >删除</el-button
          >
        </el-col>
      </el-row>

      <el-table
        v-loading="loading"
        :data="exception"
        @selection-change="handleSelectionChange"
        border
      >
        <el-table-column
          label="序号"
          align="center"
          key="userId"
          prop="userId"
        />
        <el-table-column
          label="描述"
          align="center"
          key="userName"
          prop="userName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="操作人"
          align="center"
          key="nickName"
          prop="nickName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="操作IP"
          align="center"
          key="deptName"
          prop="dept.deptName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="是否成功"
          align="center"
          key="aa"
          prop="phonenumber"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="方式"
          align="center"
          key="bb"
          prop="phonenumber"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="方法名称"
          align="center"
          key="cc"
          prop="phonenumber"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="操作时间"
          align="center"
          key="dd"
          prop="phonenumber"
          :show-overflow-tooltip="true"
        />

       
        <el-table-column
          label="操作"
          align="center"
          width="250"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['system:user:edit']"
              >查看</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['system:user:edit']"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-col>
  </div>
</template>

<script>
import {

} from "@/api/system/user";

export default {
  name: "exceptionLog",
  components: {  },
  data() {
    return {
       // 遮罩层
      loading: false,
      //搜索框显示
      showSearch:true,
      //异常列表
      exception:[],
      // 非多个禁用
      multiple: true,
       // 总条数
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        communtiyId: undefined,
      },
    };
  },
  created() {
    // this.getList();
  },
  methods: {
     /** 查询用户列表 */
    getList() {
      // this.loading = true;
      // listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
      //   (response) => {
      //     this.userList = response.rows;
      //     this.total = response.total;
      //     this.loading = false;
      //   }
      // );
    },
    /** 搜索按钮操作 */
    handleQuery() {
      //console.log(this.queryParams);
      //console.log(this.dateRange);
      this.queryParams.pageNum = 1;
      // this.getList();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },

     /** 删除按钮操作 */
    handleDelete(row) {
      const userIds = row.userId || this.ids;
      this.$confirm(
        '是否确认删除用户编号为"' + userIds + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delUser(userIds);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
 
  },
};
</script>
