<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="老师姓名" prop="teacherName">
        <el-input v-model="queryParams.teacherName" placeholder="请输入老师姓名" clearable
                  @keyup.enter.native="handleQuery"/>
      </el-form-item>

      <el-form-item label="工资日期" prop="wagesTime">
        <el-date-picker clearable v-model="queryParams.wagesTime" type="date" value-format="yyyy-MM-dd"
                        placeholder="请选择工资日期">
        </el-date-picker>
      </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="['system:teacherWages: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="['system:teacherWages: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="['system:teacherWages:remove']">删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">导入
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                   v-hasPermi="['system:teacherWages:export']">导出
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-printer" size="mini" :disabled="multiple" @click="print"
                   v-hasPermi="['system:teacherWages:export']">打印
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
    </el-row>


    <div>
      <el-table v-loading="loading" :data="teacherWagesList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center"/>
        <el-table-column label="老师姓名" v-if="columns[0].visible" fixed align="center" prop="teacherName" width="120"
                         show-overflow-tooltip/>
        <el-table-column label="身份证号" v-if="columns[1].visible" width="170" align="center" prop="idCard"/>
        <el-table-column label="基本工资" v-if="columns[2].visible" align="center" prop="basePay" width="110"/>
        <el-table-column label="奖金" v-if="columns[3].visible" align="center" prop="bonus" width="110"/>
        <el-table-column label="养老金" v-if="columns[4].visible" align="center" prop="pension" width="110"/>
        <el-table-column label="公积金" v-if="columns[5].visible" align="center" prop="accumulationFund" width="110"/>
        <el-table-column label="医疗保险" v-if="columns[6].visible" align="center" prop="medicalInsurance" width="110"/>
        <el-table-column label="车补" v-if="columns[7].visible" align="center" prop="fareSubsidy" width="110"/>
        <el-table-column label="电话补贴" v-if="columns[8].visible" align="center" prop="telephoneSubsidy" width="110"/>
        <el-table-column label="餐补" v-if="columns[9].visible" align="center" prop="mealAllowance" width="110"/>
        <el-table-column label="个人所得税" v-if="columns[10].visible" width="100" align="center" prop="incomeTax"/>
        <el-table-column label="失业保险" v-if="columns[11].visible" align="center" prop="unemploymentBenefits"
                         width="110"/>
        <el-table-column label="加班费" v-if="columns[12].visible" align="center" prop="overtimePay" width="110"/>
        <!--      <el-table-column label="工资条路径" v-if="columns[13].visible" align="center" prop="paySlipUrl"/>-->
        <el-table-column label="工资日期" v-if="columns[13].visible" align="center" prop="wagesTime" width="120">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.wagesTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="备注" v-if="columns[14].visible" align="center" width="150" prop="remarks"
                         show-overflow-tooltip/>
        <el-table-column label="操作" v-if="columns[15].visible" align="center" min-width="150"
                         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:teacherWages:edit']">修改
            </el-button>
            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                       v-hasPermi="['system:teacherWages:remove']">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!--    <el-button size="mini" type="text" @click="print(scope.row)">打印 </el-button>-->


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

    <!-- 添加老师获奖情况对话框------老师信息 -->
    <TeacherSelect v-if="teacherSelectDialog" :openSelect.sync="teacherSelectDialog" :title="teacherSelect"
                   @getTeacherList="getTeacherList" @setTeacherInfo="setTeacherInfo"></TeacherSelect>

    <!-- 添加或修改教师工资对话框 -->
    <el-dialog :title="title" :visible.sync="dialogTeacherWages" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px" style="width: 90%; margin: auto">
        <el-row>
          <el-col :span="12">
            <el-form-item label="老师姓名" prop="teacherName">
              <el-input v-model="form.teacherName" disabled placeholder="请输入老师姓名"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="身份证号" prop="idCard">
              <el-input v-model="form.idCard" disabled placeholder="请输入身份证号"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="基本工资" prop="basePay">
              <el-input v-model="form.basePay" placeholder="请输入基本工资"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="奖金" prop="bonus">
              <el-input v-model="form.bonus" placeholder="请输入奖金"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="养老金" prop="pension">
              <el-input v-model="form.pension" placeholder="请输入养老金"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公积金" prop="accumulationFund">
              <el-input v-model="form.accumulationFund" placeholder="请输入公积金"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="医疗保险" prop="medicalInsurance">
              <el-input v-model="form.medicalInsurance" placeholder="请输入医疗保险"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="车补" prop="fareSubsidy">
              <el-input v-model="form.fareSubsidy" placeholder="请输入车补"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="电话补贴" prop="telephoneSubsidy">
              <el-input v-model="form.telephoneSubsidy" placeholder="请输入电话补贴"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="餐补" prop="mealAllowance">
              <el-input v-model="form.mealAllowance" placeholder="请输入餐补"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="个人所得税" prop="incomeTax">
              <el-input v-model="form.incomeTax" placeholder="请输入个人所得税"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="失业保险" prop="unemploymentBenefits">
              <el-input v-model="form.unemploymentBenefits" placeholder="请输入失业保险"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="加班费" prop="overtimePay">
              <el-input v-model="form.overtimePay" placeholder="请输入加班费"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工资日期" style="width: 100%" prop="wagesTime">
              <el-date-picker clearable v-model="form.wagesTime" type="date" style="width: 100%"
                              value-format="yyyy-MM-dd" placeholder="请选择工资日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="备注" prop="remarks">
          <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!--    <el-dialog :visible.sync="dialogTableVisible" width="100%" style="position: relative;top: 9000px;">-->
    <!--      <div id="postFormContainer">-->
    <!--        <el-table :data="gridData">-->
    <!--          <el-table-column property="teacherName" label="老师姓名"></el-table-column>-->
    <!--          <el-table-column label="身份证号" align="center" property="idCard"/>-->
    <!--          <el-table-column label="基本工资" align="center" property="basePay"/>-->
    <!--          <el-table-column label="奖金" align="center" property="bonus"/>-->
    <!--          <el-table-column label="养老金" align="center" property="pension"/>-->
    <!--          <el-table-column label="公积金" align="center" property="accumulationFund"/>-->
    <!--          <el-table-column label="医疗保险" align="center" property="medicalInsurance"/>-->
    <!--          <el-table-column label="车补" align="center" property="fareSubsidy"/>-->
    <!--          <el-table-column label="电话补贴" align="center" property="telephoneSubsidy"/>-->
    <!--          <el-table-column label="餐补" align="center" property="mealAllowance"/>-->
    <!--          <el-table-column label="个人所得税" width="100" align="center" property="incomeTax"/>-->
    <!--          <el-table-column label="失业保险" align="center" property="unemploymentBenefits"/>-->
    <!--          <el-table-column label="加班费" align="center" property="overtimePay"/>-->
    <!--          <el-table-column label="工资日期" align="center" property="wagesTime">-->
    <!--            <template slot-scope="scope">-->
    <!--              <span>{{ parseTime(scope.row.wagesTime, '{y}-{m}-{d}') }}</span>-->
    <!--            </template>-->
    <!--          </el-table-column>-->
    <!--          <el-table-column label="备注" align="center" property="remarks"/>-->
    <!--        </el-table>-->
    <!--      </div>-->
    <!--    </el-dialog>-->

    <!-- 导入 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
                 :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
                 :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
                   @click="importTemplate">下载模板
          </el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 导出对话框 -->
    <ExportTable :open-export.sync="exportOptions.open" :title="exportOptions.title" @export="exportFile"></ExportTable>
  </div>
</template>

<script>
import {
  listTeacherWages,
  getTeacherWages,
  delTeacherWages,
  addTeacherWages,
  updateTeacherWages
} from "@/api/smartSchool/teacherManage/teacherWages";
import TeacherSelect from '@/views/components/moduleComponets/TeacherSelect/index.vue'
import { listInform } from "@/api/smartSchool/teacherManage/teacherInformation";
import { ExportType } from "@/enums/common";
import { getToken } from "@/utils/auth";
import printJS from 'print-js'


export default {
  name: "TeacherWages",
  components: { TeacherSelect },
  data() {
    return {
      rowData: [],
      selectList: [],
      dialogTableVisible: false,
      gridData: [],
      name: "TeacherWages",
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 教师工资表格数据
      teacherWagesList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      teacherSelectDialog: false,
      teacherSelect: '老师信息',
      dialogTeacherWages: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        teacherId: null,
        teacherName: null,
        idCard: null,
        basePay: null,
        bonus: null,
        pension: null,
        accumulationFund: null,
        medicalInsurance: null,
        fareSubsidy: null,
        telephoneSubsidy: null,
        mealAllowance: null,
        incomeTax: null,
        unemploymentBenefits: null,
        overtimePay: null,
        paySlipUrl: null,
        wagesTime: null,
        remarks: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      // 列信息
      columns: [
        { key: 0, label: `老师姓名`, visible: true },
        { key: 1, label: `身份证号`, visible: true },
        { key: 2, label: `基本工资`, visible: true },
        { key: 3, label: `奖金`, visible: true },
        { key: 4, label: `养老金`, visible: true },
        { key: 5, label: `公积金`, visible: true },
        { key: 6, label: `医疗保险`, visible: true },
        { key: 7, label: `车补`, visible: true },
        { key: 8, label: `电话补贴`, visible: true },
        { key: 9, label: `餐补`, visible: true },
        { key: 10, label: `个人所得税`, visible: true },
        { key: 11, label: `失业保险`, visible: true },
        { key: 12, label: `加班费`, visible: true },
        // {key: 13, label: `工资条路径`, visible: true},
        { key: 13, label: `工资日期`, visible: true },
        { key: 14, label: `备注`, visible: true },
        { key: 15, label: `操作`, visible: true },
      ],
      rules: {
        basePay: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        bonus: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        pension: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        accumulationFund: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        medicalInsurance: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        fareSubsidy: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        telephoneSubsidy: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        mealAllowance: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        incomeTax: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        unemploymentBenefits: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
        overtimePay: [{ pattern: /^([0-9])*$/, message: '该项应为数字', trigger: 'blur' }],
      },
      // 导出选项
      exportOptions: {
        title: '选择导出类别',
        open: false
      },
      //导入
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/school/teacherWages/importData"
      }
    }
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询教师工资列表 */
    getList() {
      this.loading = true;
      listTeacherWages(this.queryParams).then(response => {
        this.teacherWagesList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.dialogTeacherWages = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        teacherId: null,
        teacherName: null,
        idCard: null,
        basePay: null,
        bonus: null,
        pension: null,
        accumulationFund: null,
        medicalInsurance: null,
        fareSubsidy: null,
        telephoneSubsidy: null,
        mealAllowance: null,
        incomeTax: null,
        unemploymentBenefits: null,
        overtimePay: null,
        paySlipUrl: null,
        wagesTime: null,
        remarks: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.selectList = selection
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getTeacherWages(id).then(response => {
        this.form = response.data;
        this.dialogTeacherWages = true;
        this.title = "修改教师工资";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateTeacherWages(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.dialogTeacherWages = false;
              this.getList();
            });
          } else {
            addTeacherWages(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.dialogTeacherWages = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm(`是否确认删除选中的${ Object.hasOwnProperty.call(ids, "length") ? ids.length : 1
      }条数据？`).then(() => {
        this.loading = true;
        return delTeacherWages(ids);
      }).then(() => {
        this.getList();
        this.loading = false;
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      // 导出选中，导出全部，根据查询条件导出
      this.exportOptions.open = true;
      // this.$confirm(`是否确认导出${!!this.ids.length ? this.ids.length + '条' : '所有'}数据？`, '提示', {
      //   confirmButtonText: '确定',
      //   cancelButtonText: '取消',
      //   type: 'warning'
      // }).then(() => {
      //   if (this.ids.length) {
      //     this.download('/schoolMessagePush/export/' + this.ids, {
      //       ...this.queryParams
      //       // }, `user_${new Date().getTime()}.xlsx`)
      //     }, `教师工资.xlsx`)
      //   } else {
      //     this.download('/schoolMessagePush/export', {
      //       ...this.queryParams
      //       // }, `user_${new Date().getTime()}.xlsx`)
      //     }, `教师工资.xlsx`)
      //   }
      //   // this.$message({
      //   //   type: 'success',
      //   //   message: '导出成功!'
      //   // });
      // }).catch(() => {
      //   // this.$message({
      //   //   type: 'info',
      //   //   message: '已取消'
      //   // });
      // });
    },

    /** 导出 */
    exportFile(callback) {
      const ids = this.ids;
      const options = [
        { type: ExportType.TOTAL, path: '/school/teacherWages/export', params: {} },
        { type: ExportType.SELECT, path: '/school/teacherWages/export/' + ids, params: {} },
        { type: ExportType.QUERY, path: '/school/teacherWages/export', params: this.queryParams },
      ]
      callback(options, `老师工资${ new Date().getTime() }.xlsx`);
    },


    /** 新增按钮操作 */
    handleAdd() {
      this.teacherSelectDialog = true
      // this.reset();
      // this.dialogTeacherInform = true;
      // this.title = "老师信息";
    },

    // 新增操作
    handleAddLate(data) {
      this.teacherSelectDialog = false;
      this.reset();
      this.form.teacherName = data.teacherName;
      this.form.idCard = data.idCard;
      this.form.teacherId = data.id;
      this.dialogTeacherWages = true;
      this.title = "教师工资信息";
    },
    /** 获取老师信息列表 */
    getTeacherList(queryForm, callback) {
      listInform(queryForm).then(response => {
        callback(response.rows, response.total);
      }).catch(error => {
        callback([], 0);
      })
    },
    // 新增操作
    setTeacherInfo(data) {
      this.teacherSelectDialog = false;
      this.reset();
      this.form.teacherName = data.teacherName;
      this.form.teacherId = data.id;
      this.form.idCard = data.idCard;
      this.dialogTeacherWages = true;
      this.title = "老师工资信息";
    },

    /** 导入按钮 */
    handleImport() {
      this.upload.title = "用户导入";
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('school/teacherWages/importTemplate', {}, `老师工资模板_${ new Date().getTime() }.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    // 打印方法
    print(row) {
      const printList = row
      this.rowData = row
      // const printList = this.rowData || this.selectList
      // console.log(row)
      printJS({
        printable: this.selectList,
        properties: [
          { field: "teacherName", displayName: "姓名" },
          // { field: "idCard", displayName: "身份证号" },
          { field: "basePay", displayName: "基本工资" },
          { field: "bonus", displayName: "奖金" },
          { field: "pension", displayName: "养老金" },
          { field: "accumulationFund", displayName: "公积金" },
          { field: "medicalInsurance", displayName: "医疗保险" },
          { field: "fareSubsidy", displayName: "车补" },
          { field: "telephoneSubsidy", displayName: "电话补贴" },
          { field: "mealAllowance", displayName: "餐补" },
          { field: "incomeTax", displayName: "个人所得税" },
          { field: "unemploymentBenefits", displayName: "失业保险" },
          { field: "overtimePay", displayName: "加班费" },
          // { field: "wagesTime", displayName: "日期" },
          // { field: "remarks", displayName: "备注" },
        ],
        gridHeaderStyle: "border: 1px solid black",
        type: "json",
        gridStyle: `text-align: center; border: 1px solid black`,
        header: "工资条信息",
      });

    },

    // print(row) {
    //   this.dialogTableVisible = true;
    //   // 找到teacherWagesList中的id为row.id的数据
    //   this.teacherWagesList.forEach(item => {
    //     if (item.id == row.id) {
    //       this.gridData.push(item);
    //     }
    //   })
    //   setTimeout(() => {
    //     printJS({
    //       printable: 'postFormContainer',
    //       type: 'html',
    //       maxWidth: 10000,
    //       header: '',
    //       ignoreElements: ['no-print', 'back-no-print', 'front-no-print'],
    //       targetStyles: ['*'],
    //     })
    //   }, 0);
    //   setTimeout(() => {
    //     this.gridData = [];
    //     this.dialogTableVisible = false;
    //   }, 1000);
    // },

  }
};
</script>
