<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="租户id" prop="tenantId">
        <el-input
          v-model="queryParams.tenantId"
          placeholder="请输入租户id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年" prop="year">
        <el-input
          v-model="queryParams.year"
          placeholder="请输入年"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="月" prop="month">
        <el-input
          v-model="queryParams.month"
          placeholder="请输入月"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门id" prop="deptId">
        <el-input
          v-model="queryParams.deptId"
          placeholder="请输入部门id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门名称" prop="deptName">
        <el-input
          v-model="queryParams.deptName"
          placeholder="请输入部门名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工id" prop="employeeId">
        <el-input
          v-model="queryParams.employeeId"
          placeholder="请输入员工id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工姓名" prop="employeeName">
        <el-input
          v-model="queryParams.employeeName"
          placeholder="请输入员工姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="基本工资" prop="basicSalary">
        <el-input
          v-model="queryParams.basicSalary"
          placeholder="请输入基本工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实际出勤天数" prop="actuallyDays">
        <el-input
          v-model="queryParams.actuallyDays"
          placeholder="请输入实际出勤天数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实际出勤小时数" prop="actuallyHours">
        <el-input
          v-model="queryParams.actuallyHours"
          placeholder="请输入实际出勤小时数"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出勤工时" prop="dayWorkHours">
        <el-input
          v-model="queryParams.dayWorkHours"
          placeholder="请输入出勤工时"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="包活工时" prop="workOrderHours">
        <el-input
          v-model="queryParams.workOrderHours"
          placeholder="请输入包活工时"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="加班工时" prop="overtimeWorkHours">
        <el-input
          v-model="queryParams.overtimeWorkHours"
          placeholder="请输入加班工时"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label=" 日工帮工工时" prop="rigongHelpHours">
        <el-input
          v-model="queryParams.rigongHelpHours"
          placeholder="请输入 日工帮工工时"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="日工工资" prop="dayWorkPay">
        <el-input
          v-model="queryParams.dayWorkPay"
          placeholder="请输入日工工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="包活工资" prop="workOrderPay">
        <el-input
          v-model="queryParams.workOrderPay"
          placeholder="请输入包活工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="加班工资" prop="overtime">
        <el-input
          v-model="queryParams.overtime"
          placeholder="请输入加班工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="帮工工资" prop="banggongPay">
        <el-input
          v-model="queryParams.banggongPay"
          placeholder="请输入帮工工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="值班/拉货工资 废弃" prop="zhibanOrLahuo">
        <el-input
          v-model="queryParams.zhibanOrLahuo"
          placeholder="请输入值班/拉货工资 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="节假日工资 废弃" prop="holiday">
        <el-input
          v-model="queryParams.holiday"
          placeholder="请输入节假日工资 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="岗位津贴 废弃" prop="post">
        <el-input
          v-model="queryParams.post"
          placeholder="请输入岗位津贴 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="话费及其他补贴 废弃" prop="phoneCharge">
        <el-input
          v-model="queryParams.phoneCharge"
          placeholder="请输入话费及其他补贴 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同补 废弃" prop="contract">
        <el-input
          v-model="queryParams.contract"
          placeholder="请输入合同补 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="全勤奖 废弃" prop="fullTime">
        <el-input
          v-model="queryParams.fullTime"
          placeholder="请输入全勤奖 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="上月差异 废弃" prop="diffOfLastMonth">
        <el-input
          v-model="queryParams.diffOfLastMonth"
          placeholder="请输入上月差异 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="应付工资" prop="shoudPayMoney">
        <el-input
          v-model="queryParams.shoudPayMoney"
          placeholder="请输入应付工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扣款忘刷迟到 废弃" prop="late">
        <el-input
          v-model="queryParams.late"
          placeholder="请输入扣款忘刷迟到 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="扣款保险/党费 废弃" prop="insurance">
        <el-input
          v-model="queryParams.insurance"
          placeholder="请输入扣款保险/党费 废弃"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实发工资" prop="actuallyPayMoney">
        <el-input
          v-model="queryParams.actuallyPayMoney"
          placeholder="请输入实发工资"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工补贴对象" prop="allButieData">
        <el-input
          v-model="queryParams.allButieData"
          placeholder="请输入员工补贴对象"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="备注" prop="note">
        <el-input
          v-model="queryParams.note"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="员工工资是否可查" prop="empQuery">
        <el-input
          v-model="queryParams.empQuery"
          placeholder="请输入员工工资是否可查"
          clearable
          @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="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['pay:salaryReport:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['pay:salaryReport:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['pay:salaryReport:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['pay:salaryReport:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="salaryReportList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键" align="center" prop="id" v-if="true"/>
      <el-table-column label="租户id" align="center" prop="tenantId" />
      <el-table-column label="年" align="center" prop="year" />
      <el-table-column label="月" align="center" prop="month" />
      <el-table-column label="部门id" align="center" prop="deptId" />
      <el-table-column label="部门名称" align="center" prop="deptName" />
      <el-table-column label="员工id" align="center" prop="employeeId" />
      <el-table-column label="员工姓名" align="center" prop="employeeName" />
      <el-table-column label="基本工资" align="center" prop="basicSalary" />
      <el-table-column label="实际出勤天数" align="center" prop="actuallyDays" />
      <el-table-column label="实际出勤小时数" align="center" prop="actuallyHours" />
      <el-table-column label="出勤工时" align="center" prop="dayWorkHours" />
      <el-table-column label="包活工时" align="center" prop="workOrderHours" />
      <el-table-column label="加班工时" align="center" prop="overtimeWorkHours" />
      <el-table-column label=" 日工帮工工时" align="center" prop="rigongHelpHours" />
      <el-table-column label="日工工资" align="center" prop="dayWorkPay" />
      <el-table-column label="包活工资" align="center" prop="workOrderPay" />
      <el-table-column label="加班工资" align="center" prop="overtime" />
      <el-table-column label="帮工工资" align="center" prop="banggongPay" />
      <el-table-column label="值班/拉货工资 废弃" align="center" prop="zhibanOrLahuo" />
      <el-table-column label="节假日工资 废弃" align="center" prop="holiday" />
      <el-table-column label="岗位津贴 废弃" align="center" prop="post" />
      <el-table-column label="话费及其他补贴 废弃" align="center" prop="phoneCharge" />
      <el-table-column label="合同补 废弃" align="center" prop="contract" />
      <el-table-column label="全勤奖 废弃" align="center" prop="fullTime" />
      <el-table-column label="上月差异 废弃" align="center" prop="diffOfLastMonth" />
      <el-table-column label="应付工资" align="center" prop="shoudPayMoney" />
      <el-table-column label="扣款忘刷迟到 废弃" align="center" prop="late" />
      <el-table-column label="扣款保险/党费 废弃" align="center" prop="insurance" />
      <el-table-column label="实发工资" align="center" prop="actuallyPayMoney" />
      <el-table-column label="员工补贴对象" align="center" prop="allButieData" />
      <el-table-column label="备注" align="center" prop="note" />
      <el-table-column label="员工工资是否可查" align="center" prop="empQuery" />
      <el-table-column label="操作" align="center" 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="['pay:salaryReport:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['pay:salaryReport:remove']"
          >删除</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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="租户id" prop="tenantId">
          <el-input v-model="form.tenantId" placeholder="请输入租户id" />
        </el-form-item>
        <el-form-item label="年" prop="year">
          <el-input v-model="form.year" placeholder="请输入年" />
        </el-form-item>
        <el-form-item label="月" prop="month">
          <el-input v-model="form.month" placeholder="请输入月" />
        </el-form-item>
        <el-form-item label="部门id" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门id" />
        </el-form-item>
        <el-form-item label="部门名称" prop="deptName">
          <el-input v-model="form.deptName" placeholder="请输入部门名称" />
        </el-form-item>
        <el-form-item label="员工id" prop="employeeId">
          <el-input v-model="form.employeeId" placeholder="请输入员工id" />
        </el-form-item>
        <el-form-item label="员工姓名" prop="employeeName">
          <el-input v-model="form.employeeName" placeholder="请输入员工姓名" />
        </el-form-item>
        <el-form-item label="基本工资" prop="basicSalary">
          <el-input v-model="form.basicSalary" placeholder="请输入基本工资" />
        </el-form-item>
        <el-form-item label="实际出勤天数" prop="actuallyDays">
          <el-input v-model="form.actuallyDays" placeholder="请输入实际出勤天数" />
        </el-form-item>
        <el-form-item label="实际出勤小时数" prop="actuallyHours">
          <el-input v-model="form.actuallyHours" placeholder="请输入实际出勤小时数" />
        </el-form-item>
        <el-form-item label="出勤工时" prop="dayWorkHours">
          <el-input v-model="form.dayWorkHours" placeholder="请输入出勤工时" />
        </el-form-item>
        <el-form-item label="包活工时" prop="workOrderHours">
          <el-input v-model="form.workOrderHours" placeholder="请输入包活工时" />
        </el-form-item>
        <el-form-item label="加班工时" prop="overtimeWorkHours">
          <el-input v-model="form.overtimeWorkHours" placeholder="请输入加班工时" />
        </el-form-item>
        <el-form-item label=" 日工帮工工时" prop="rigongHelpHours">
          <el-input v-model="form.rigongHelpHours" placeholder="请输入 日工帮工工时" />
        </el-form-item>
        <el-form-item label="日工工资" prop="dayWorkPay">
          <el-input v-model="form.dayWorkPay" placeholder="请输入日工工资" />
        </el-form-item>
        <el-form-item label="包活工资" prop="workOrderPay">
          <el-input v-model="form.workOrderPay" placeholder="请输入包活工资" />
        </el-form-item>
        <el-form-item label="加班工资" prop="overtime">
          <el-input v-model="form.overtime" placeholder="请输入加班工资" />
        </el-form-item>
        <el-form-item label="帮工工资" prop="banggongPay">
          <el-input v-model="form.banggongPay" placeholder="请输入帮工工资" />
        </el-form-item>
        <el-form-item label="值班/拉货工资 废弃" prop="zhibanOrLahuo">
          <el-input v-model="form.zhibanOrLahuo" placeholder="请输入值班/拉货工资 废弃" />
        </el-form-item>
        <el-form-item label="节假日工资 废弃" prop="holiday">
          <el-input v-model="form.holiday" placeholder="请输入节假日工资 废弃" />
        </el-form-item>
        <el-form-item label="岗位津贴 废弃" prop="post">
          <el-input v-model="form.post" placeholder="请输入岗位津贴 废弃" />
        </el-form-item>
        <el-form-item label="话费及其他补贴 废弃" prop="phoneCharge">
          <el-input v-model="form.phoneCharge" placeholder="请输入话费及其他补贴 废弃" />
        </el-form-item>
        <el-form-item label="合同补 废弃" prop="contract">
          <el-input v-model="form.contract" placeholder="请输入合同补 废弃" />
        </el-form-item>
        <el-form-item label="全勤奖 废弃" prop="fullTime">
          <el-input v-model="form.fullTime" placeholder="请输入全勤奖 废弃" />
        </el-form-item>
        <el-form-item label="上月差异 废弃" prop="diffOfLastMonth">
          <el-input v-model="form.diffOfLastMonth" placeholder="请输入上月差异 废弃" />
        </el-form-item>
        <el-form-item label="应付工资" prop="shoudPayMoney">
          <el-input v-model="form.shoudPayMoney" placeholder="请输入应付工资" />
        </el-form-item>
        <el-form-item label="扣款忘刷迟到 废弃" prop="late">
          <el-input v-model="form.late" placeholder="请输入扣款忘刷迟到 废弃" />
        </el-form-item>
        <el-form-item label="扣款保险/党费 废弃" prop="insurance">
          <el-input v-model="form.insurance" placeholder="请输入扣款保险/党费 废弃" />
        </el-form-item>
        <el-form-item label="实发工资" prop="actuallyPayMoney">
          <el-input v-model="form.actuallyPayMoney" placeholder="请输入实发工资" />
        </el-form-item>
        <el-form-item label="员工补贴对象" prop="allButieData">
          <el-input v-model="form.allButieData" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="备注" prop="note">
          <el-input v-model="form.note" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="员工工资是否可查" prop="empQuery">
          <el-input v-model="form.empQuery" placeholder="请输入员工工资是否可查" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listSalaryReport, getSalaryReport, delSalaryReport, addSalaryReport, updateSalaryReport } from "@/api/pay/salaryReport";

export default {
  name: "SalaryReport",
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 工资明细总表格数据
      salaryReportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        tenantId: undefined,
        year: undefined,
        month: undefined,
        deptId: undefined,
        deptName: undefined,
        employeeId: undefined,
        employeeName: undefined,
        basicSalary: undefined,
        actuallyDays: undefined,
        actuallyHours: undefined,
        dayWorkHours: undefined,
        workOrderHours: undefined,
        overtimeWorkHours: undefined,
        rigongHelpHours: undefined,
        dayWorkPay: undefined,
        workOrderPay: undefined,
        overtime: undefined,
        banggongPay: undefined,
        zhibanOrLahuo: undefined,
        holiday: undefined,
        post: undefined,
        phoneCharge: undefined,
        contract: undefined,
        fullTime: undefined,
        diffOfLastMonth: undefined,
        shoudPayMoney: undefined,
        late: undefined,
        insurance: undefined,
        actuallyPayMoney: undefined,
        allButieData: undefined,
        note: undefined,
        empQuery: undefined
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        id: [
          { required: true, message: "主键不能为空", trigger: "blur" }
        ],
        tenantId: [
          { required: true, message: "租户id不能为空", trigger: "blur" }
        ],
        year: [
          { required: true, message: "年不能为空", trigger: "blur" }
        ],
        month: [
          { required: true, message: "月不能为空", trigger: "blur" }
        ],
        deptId: [
          { required: true, message: "部门id不能为空", trigger: "blur" }
        ],
        deptName: [
          { required: true, message: "部门名称不能为空", trigger: "blur" }
        ],
        employeeId: [
          { required: true, message: "员工id不能为空", trigger: "blur" }
        ],
        employeeName: [
          { required: true, message: "员工姓名不能为空", trigger: "blur" }
        ],
        basicSalary: [
          { required: true, message: "基本工资不能为空", trigger: "blur" }
        ],
        actuallyDays: [
          { required: true, message: "实际出勤天数不能为空", trigger: "blur" }
        ],
        actuallyHours: [
          { required: true, message: "实际出勤小时数不能为空", trigger: "blur" }
        ],
        dayWorkHours: [
          { required: true, message: "出勤工时不能为空", trigger: "blur" }
        ],
        workOrderHours: [
          { required: true, message: "包活工时不能为空", trigger: "blur" }
        ],
        overtimeWorkHours: [
          { required: true, message: "加班工时不能为空", trigger: "blur" }
        ],
        rigongHelpHours: [
          { required: true, message: " 日工帮工工时不能为空", trigger: "blur" }
        ],
        dayWorkPay: [
          { required: true, message: "日工工资不能为空", trigger: "blur" }
        ],
        workOrderPay: [
          { required: true, message: "包活工资不能为空", trigger: "blur" }
        ],
        overtime: [
          { required: true, message: "加班工资不能为空", trigger: "blur" }
        ],
        banggongPay: [
          { required: true, message: "帮工工资不能为空", trigger: "blur" }
        ],
        zhibanOrLahuo: [
          { required: true, message: "值班/拉货工资 废弃不能为空", trigger: "blur" }
        ],
        holiday: [
          { required: true, message: "节假日工资 废弃不能为空", trigger: "blur" }
        ],
        post: [
          { required: true, message: "岗位津贴 废弃不能为空", trigger: "blur" }
        ],
        phoneCharge: [
          { required: true, message: "话费及其他补贴 废弃不能为空", trigger: "blur" }
        ],
        contract: [
          { required: true, message: "合同补 废弃不能为空", trigger: "blur" }
        ],
        fullTime: [
          { required: true, message: "全勤奖 废弃不能为空", trigger: "blur" }
        ],
        diffOfLastMonth: [
          { required: true, message: "上月差异 废弃不能为空", trigger: "blur" }
        ],
        shoudPayMoney: [
          { required: true, message: "应付工资不能为空", trigger: "blur" }
        ],
        late: [
          { required: true, message: "扣款忘刷迟到 废弃不能为空", trigger: "blur" }
        ],
        insurance: [
          { required: true, message: "扣款保险/党费 废弃不能为空", trigger: "blur" }
        ],
        actuallyPayMoney: [
          { required: true, message: "实发工资不能为空", trigger: "blur" }
        ],
        allButieData: [
          { required: true, message: "员工补贴对象不能为空", trigger: "blur" }
        ],
        note: [
          { required: true, message: "备注不能为空", trigger: "blur" }
        ],
        empQuery: [
          { required: true, message: "员工工资是否可查不能为空", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询工资明细总列表 */
    getList() {
      this.loading = true;
      listSalaryReport(this.queryParams).then(response => {
        this.salaryReportList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        tenantId: undefined,
        year: undefined,
        month: undefined,
        deptId: undefined,
        deptName: undefined,
        employeeId: undefined,
        employeeName: undefined,
        basicSalary: undefined,
        actuallyDays: undefined,
        actuallyHours: undefined,
        dayWorkHours: undefined,
        workOrderHours: undefined,
        overtimeWorkHours: undefined,
        rigongHelpHours: undefined,
        dayWorkPay: undefined,
        workOrderPay: undefined,
        overtime: undefined,
        banggongPay: undefined,
        zhibanOrLahuo: undefined,
        holiday: undefined,
        post: undefined,
        phoneCharge: undefined,
        contract: undefined,
        fullTime: undefined,
        diffOfLastMonth: undefined,
        shoudPayMoney: undefined,
        late: undefined,
        insurance: undefined,
        actuallyPayMoney: undefined,
        allButieData: undefined,
        note: undefined,
        empQuery: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加工资明细总";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getSalaryReport(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改工资明细总";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateSalaryReport(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addSalaryReport(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除工资明细总编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delSalaryReport(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('pay/salaryReport/export', {
        ...this.queryParams
      }, `salaryReport_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
