<template>
  <!-- 投诉建议 -->
  <div>
    <actionBar menuTitle="投诉建议" :operateList="operateList" :formList="formList" :ruleForm="searchRuleForm"
      @openModel="openModel"></actionBar>
    <tables :key="Math.random()" :suspension="false" :tableList="tableList" :tableData="tableData"
      @buttonData="buttonData"></tables>
    <!-- 分页 -->
    <div class="paging_bottom" v-if="Total">
      <pagination :total="Total" :currentPage="Pagination.PageIndex" @changeSize="changeSize"
        @changeCurrent="changeCurrent">
      </pagination>
    </div>
    <el-dialog :title="staffTitle" :visible.sync="staffDialogVisible" width="600px" :close-on-click-modal="false">
      <forms ref="childRules" :formNewList="formRuleList" labelWidth="100px"></forms>
      <span slot="footer" class="dialog-footer">
        <el-button plain @click="staffDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="staffDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import actionBar from '@/components/actionBar'
  import tables from '@/components/tables'
  import pagination from '@/components/pagination'
  import forms from '@/components/forms'
  import {
    formRules,
    employee
  } from "./accuse.js";
  export default {
    components: {
      actionBar,
      tables,
      pagination,
      forms
    },
    data() {
      return {
        staffTitle: '添加',
        staffDialogVisible: false,
        Pagination: {
          PageIndex: 1,
          PageSize: 10,
        },
        operateList: [{
          type: 'add',
          title: '添加',
          icon: 'el-icon-plus',
        }],
        formList: [{
          type: 'input',
          label: '提交人',
          field: 'name',
          placeholder: '提交人',
        }],
        searchRuleForm: {
          name: '',
        },
        tableList: employee(),
        tableData: [{
          T_name: '2154'
        }, {
          T_name: '2154'
        }, {
          T_name: '2154'
        }],
        Total: 10,
        formRuleList: [],
        operationType: '',
      }
    },
    mounted() {
      const dataList = formRules();
      this.formRuleList = dataList;
      console.log(this.formRuleList, 25)
    },
    methods: {
      openModel(type) {
        console.log(type, 24)
        if (type == 'add') {
          this.staffTitle = '添加'
        }
        this.staffDialogVisible = true
      },
      buttonData(row, type) {
        this.operationType = type
        console.log(row, type, 25)
        if (type == 'edit') {
          this.staffTitle = '编辑'
        } else {
          this.staffTitle = '详情'
        }
        this.staffDialogVisible = true
      },
      changeSize(val) {
        this.Pagination.PageSize = val
      },
      changeCurrent(val) {
        this.Pagination.PageIndex = val
      },
    }
  }
</script>

<style lang="scss" scoped>
</style>
