<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8"  style="margin-left: 0; margin-top: 10px">
      <el-button
        type="primary"
        plain
        icon="el-icon-plus"
        size="mini"
        @click="synchronousEven"
        v-hasPermi="['gateMr:gateMr:synchronous']"
      >同步</el-button>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table ref="tables" v-loading="loading" :data="dataList" border>
      <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
      <el-table-column label="设备名称" align="center" prop="" />
      <el-table-column label="设备型号" align="center" prop="" />
      <el-table-column label="验票站点" align="center" prop="" />
      <el-table-column label="出口\入口" align="center" prop="" />
      <el-table-column label="设备编码" align="center" prop="" />
      <el-table-column label="在线状态" align="center" prop="" />
      <el-table-column label="添加时间" align="center" prop="createTime" width="160" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleOpen(scope.row)"
            v-hasPermi="['gateMr:gateMr:open']"
          >开闸</el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleClose(scope.row,scope.index)"
            v-hasPermi="['gateMr:gateMr:close']"
          >关闸</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"
    />

  </div>
</template>

<script>

import { pageList, downOrderListXls } from '@/api/financeMr/flowingWaterMr'
import { exportExcel } from '@/utils/exportexcel'
export default {
  name: "agreement",
  dicts: ['agreement_type'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      dataList: null,
      // 弹出层标题
      title: "",

      // 是否显示弹出层
      open: false,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      statusList: [
        {id: 1, name: '申请中', value: 0},
        {id: 2, name: '退款成功', value: 1},
        {id: 3, name: '退款失败', value: 2},
        {id: 4, name: '退款中', value: 3},
      ],
      sourceMap: {
        1: '小程序',
        2: '美团',
        3: '携程',
        4: '公众号',
        5: '支付宝',
      },
      incomeExpensesList: [
        {id: 1, name: '收入', value: '收入'},
        {id: 2, name: '支出', value: '支出'},
      ],
      businessTypeList: [
        {id: 1, name: '购买演出票', value: '购买演出票'},
        {id: 2, name: '票务退款', value: '票务退款'},
      ],
      visibleStatus: false,
      newObj: {},
      visibleType: '',
      handleExportLoading: false,
      tableData: {}
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      pageList(this.queryParams)
      .then(response => {
          this.dataList = response.data.rows;
          this.total = response.data.total;
          this.loading = false;
        }
      );
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.$set(this.queryParams, 'id', '');
      this.$set(this.queryParams, 'businessType', '');
      this.$set(this.queryParams, 'incomeExpenses', '');
      this.queryParams.pageNum = 1;
      this.handleQuery();
    },
    /** 详情按钮操作 */
    openDetails(row, type) {
      this.$refs["detailsDia"].openDialog("详情", row, type);
    },
    /**
     * 同步
     * @date 2022-10-24
     * @returns {any}
     */
    synchronousEven() {

    },
    // 开闸
    handleOpen() {

    },
    // 关闸
    handleClose() {

    },
  }
};
</script>
