<!--
 * @Author: zhp
 * @Date: 2023-01-11 09:24:58
 * @LastEditTime: 2023-06-26 13:39:19
 * @LastEditors: zhp
 * @Description: 
-->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sys__user">
      <SearchBar :formConfigs="formConfig" ref="ruleForm" @headBtnClick="buttonClick">
        <!-- <el-button type="primary" size="small" plain>导入</el-button> -->
      </SearchBar>
      <base-table :table-props="tableProps" :page="listQuery.page" :limit="listQuery.limit" :table-data="tableData">
        <method-btn v-if="tableBtn.length" slot="handleBtn" :width="100" label="操作" :method-list="tableBtn"
          @clickBtn="handleClick" />
      </base-table>
      <pagination :limit.sync="listQuery.limit" :page.sync="listQuery.page" :total="listQuery.total"
        @pagination="getDataList" />
      <!-- 弹窗, 新增 / 修改 -->
      <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel"
        @confirm="handleConfirm" :before-close="handleCancel">
        <teamMember-add ref="addOrUpdate" @successSubmit="successSubmit"></teamMember-add>
      </base-dialog>
    </div>
  </el-card>
</template>

<script>
import basicPage from "@/mixins/basic-page";
import teamMemberAdd from './components/teamMember-add'
import i18n from "@/i18n";
const tableProps = [
  {
    prop: "paramCode",
    label: i18n.t("params.paramCode"),
  },
  {
    prop: "paramValue",
    label: i18n.t("params.paramValue"),
  },
  {
    prop: "remark",
    label: i18n.t("params.remark"),
  },
];
const tableBtn = [
  {
    type: "edit",
    btnName: "编辑",
  },
  {
    type: "delete",
    btnName: "删除",
  },
];
export default {
  mixins: [basicPage],
  data() {
    return {
      urlOptions: {
        getDataListURL: "/basic/qmsTeamMember/page",
        deleteURL: "/basic/qmsControlMode",
      },
      tableProps,
      tableBtn,
      formConfig: [
        // {
        //   type: "",
        //   label: i18n.t("params.paramCode"),
        //   placeholder: i18n.t("params.paramCode"),
        //   param: "paramCode",
        // },
        // {
        //   type: "separate",
        // },
        {
          type: "button",
          btnName: "新增",
          name: "add",
          color: "primary",
        },
      ],
    };
  },
  components: {
    teamMemberAdd,
  },
  methods:{
    //search-bar点击
    buttonClick(val) {
      switch (val.btnName) {
        case "search":
          // this.listQuery.paramCode = val.paramCode;
          this.listQuery.page = 1;
          this.getDataList();
          break;
        case "add":
          this.addOrEditTitle = '新增'
          this.addOrUpdateVisible = true;   
          this.addOrUpdateHandle()
          break;
        default:
          console.log(val)
       }
    },
  }
};
</script>
