<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="userId">
        <el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="ID" prop="patientid">
        <el-input v-model="queryParams.patientid" placeholder="请输入就诊ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>

      <el-form-item label="开始时间" prop="startDate1">
        <el-date-picker v-model="queryParams.startDate" style="width: 240px" value-format="yyyy-MM-dd" type="date"/>
      </el-form-item>
      <el-form-item label="结束时间" prop="endDate1">
        <el-date-picker v-model="queryParams.endDate" style="width: 240px" value-format="yyyy-MM-dd" type="date"/>
      </el-form-item>
      
      <!-- <el-form-item label="检查项目名称" prop="creatitemname">
        <el-input v-model="queryParams.creatitemname" placeholder="请输入检查项目名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="预约时间" prop="appointmenttime">
        <el-date-picker v-model="queryParams.appointmenttime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="创建时间" prop="creatdate">
        <el-date-picker v-model="queryParams.creatdate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="查询方式" prop="querytype">
        <el-select v-model="queryParams.querytype" placeholder="请选择查询方式" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="订单ID" prop="orderno">
        <el-input v-model="queryParams.orderno" placeholder="请输入订单ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="单据ID" prop="flowno">
        <el-input v-model="queryParams.flowno" placeholder="请输入单据ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="开单科室编号" prop="setdepartcode">
        <el-input v-model="queryParams.setdepartcode" placeholder="请输入开单科室编号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="开单科室名称" prop="setdepartname">
        <el-input v-model="queryParams.setdepartname" placeholder="请输入开单科室名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="执行科室编号" prop="dodepartcode">
        <el-input v-model="queryParams.dodepartcode" placeholder="请输入执行科室编号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="执行科室名称" prop="dodepartname">
        <el-input v-model="queryParams.dodepartname" placeholder="请输入执行科室名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="单据类别" prop="billtype">
        <el-select v-model="queryParams.billtype" placeholder="请选择单据类别" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="单据名称" prop="billname">
        <el-input v-model="queryParams.billname" placeholder="请输入单据名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="单据描述" prop="billdes">
        <el-input v-model="queryParams.billdes" placeholder="请输入单据描述" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="开单时间" prop="billtime">
        <el-date-picker v-model="queryParams.billtime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="项目总金额" prop="billmoney">
        <el-input v-model="queryParams.billmoney" placeholder="请输入项目总金额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="医生代码" prop="doctorcode">
        <el-input v-model="queryParams.doctorcode" placeholder="请输入医生代码" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="医生名称" prop="doctorname">
        <el-input v-model="queryParams.doctorname" placeholder="请输入医生名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="自费金额" prop="sincemoney">
        <el-input v-model="queryParams.sincemoney" placeholder="请输入自费金额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="公费金额" prop="fairmoney">
        <el-input v-model="queryParams.fairmoney" placeholder="请输入公费金额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="开单流水" prop="serialno">
        <el-input v-model="queryParams.serialno" placeholder="请输入开单流水" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="申请单号" prop="appointno">
        <el-input v-model="queryParams.appointno" placeholder="请输入申请单号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="就诊流水号" prop="serialflowno">
        <el-input v-model="queryParams.serialflowno" placeholder="请输入就诊流水号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="就诊类别" prop="jzlb">
        <el-input v-model="queryParams.jzlb" placeholder="请输入就诊类别" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="病种类别代码" prop="bzdm">
        <el-input v-model="queryParams.bzdm" placeholder="请输入病种类别代码" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="更新时间" prop="updatedate">
        <el-date-picker v-model="queryParams.updatedate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="账单信息" prop="billsmsg">
        <el-input v-model="queryParams.billsmsg" placeholder="请输入账单信息" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="支付签名" prop="paynature">
        <el-input v-model="queryParams.paynature" placeholder="请输入支付签名" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="支付类别" prop="paytype">
        <el-select v-model="queryParams.paytype" placeholder="请选择支付类别" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="支付ID" prop="powertranid">
        <el-input v-model="queryParams.powertranid" placeholder="请输入支付ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="支付卡号" prop="powertrancard">
        <el-input v-model="queryParams.powertrancard" placeholder="请输入支付卡号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="终端ID" prop="terminalid">
        <el-input v-model="queryParams.terminalid" placeholder="请输入终端ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="参考号" prop="referno">
        <el-input v-model="queryParams.referno" placeholder="请输入参考号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="支付金额" prop="zfamount">
        <el-input v-model="queryParams.zfamount" placeholder="请输入支付金额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="医保金额" prop="ybzhamount">
        <el-input v-model="queryParams.ybzhamount" placeholder="请输入医保金额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="医保余额" prop="ybtcamount">
        <el-input v-model="queryParams.ybtcamount" placeholder="请输入医保余额" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="医保信息" prop="yboutmsg">
        <el-input v-model="queryParams.yboutmsg" placeholder="请输入医保信息" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="his参考号" prop="hisopernum">
        <el-input v-model="queryParams.hisopernum" placeholder="请输入his参考号" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="工行ID" prop="icbcorderid">
        <el-input v-model="queryParams.icbcorderid" placeholder="请输入工行ID" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="工行支付时间" prop="icbcpaytime">
        <el-date-picker v-model="queryParams.icbcpaytime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="标志" prop="appFlag">
        <el-input v-model="queryParams.appFlag" placeholder="请输入标志" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>
      <el-form-item label="开单状态" prop="appStatus">
        <el-select v-model="queryParams.appStatus" placeholder="请选择开单状态" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="提交时间" prop="ctime">
        <el-date-picker v-model="queryParams.ctime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item>
      <el-form-item label="修改时间" prop="utime">
        <el-date-picker v-model="queryParams.utime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @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:mzjf:create']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
                   v-hasPermi="['system:mzjf:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="用户ID" align="center" prop="userId" />
      <el-table-column label="就诊卡id" align="center" prop="cardId" />
      <el-table-column label="ID" align="center" prop="patientid" />
      <el-table-column label="证件类型" align="center" prop="idtype" />
      <el-table-column label="操作类型" align="center" prop="locktype" />
      <el-table-column label="检查项目名称" align="center" prop="creatitemname" />
      <el-table-column label="预约时间" align="center" prop="appointmenttime" />
      <el-table-column label="创建时间" align="center" prop="creatdate" />
      <el-table-column label="查询方式" align="center" prop="querytype" />
      <el-table-column label="订单ID" align="center" prop="orderno" />
      <el-table-column label="单据ID" align="center" prop="flowno" />
      <el-table-column label="开单科室编号" align="center" prop="setdepartcode" />
      <el-table-column label="开单科室名称" align="center" prop="setdepartname" />
      <el-table-column label="执行科室编号" align="center" prop="dodepartcode" />
      <el-table-column label="执行科室名称" align="center" prop="dodepartname" />
      <el-table-column label="单据类别" align="center" prop="billtype" />
      <el-table-column label="单据名称" align="center" prop="billname" />
      <el-table-column label="单据描述" align="center" prop="billdes" />
      <el-table-column label="开单时间" align="center" prop="billtime" />
      <el-table-column label="项目总金额" align="center" prop="billmoney" />
      <el-table-column label="医生代码" align="center" prop="doctorcode" />
      <el-table-column label="医生名称" align="center" prop="doctorname" />
      <el-table-column label="自费金额" align="center" prop="sincemoney" />
      <el-table-column label="公费金额" align="center" prop="fairmoney" />
      <el-table-column label="开单流水" align="center" prop="serialno" />
      <el-table-column label="申请单号" align="center" prop="appointno" />
      <el-table-column label="就诊流水号" align="center" prop="serialflowno" />
      <el-table-column label="就诊类别" align="center" prop="jzlb" />
      <el-table-column label="病种类别代码" align="center" prop="bzdm" />
      <el-table-column label="更新时间" align="center" prop="updatedate" />
      <el-table-column label="账单信息" align="center" prop="billsmsg" />
      <el-table-column label="支付签名" align="center" prop="paynature" />
      <el-table-column label="支付类别" align="center" prop="paytype" />
      <el-table-column label="支付ID" align="center" prop="powertranid" />
      <el-table-column label="支付卡号" align="center" prop="powertrancard" />
      <el-table-column label="终端ID" align="center" prop="terminalid" />
      <el-table-column label="参考号" align="center" prop="referno" />
      <el-table-column label="支付金额" align="center" prop="zfamount" />
      <el-table-column label="医保金额" align="center" prop="ybzhamount" />
      <el-table-column label="医保余额" align="center" prop="ybtcamount" />
      <el-table-column label="医保信息" align="center" prop="yboutmsg" />
      <el-table-column label="his参考号" align="center" prop="hisopernum" />
      <el-table-column label="工行ID" align="center" prop="icbcorderid" />
      <el-table-column label="工行支付时间" align="center" prop="icbcpaytime" />
      <el-table-column label="标志" align="center" prop="appFlag" />
      <el-table-column label="开单状态" align="center" prop="appStatus" />
      <el-table-column label="提交时间" align="center" prop="ctime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.ctime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="修改时间" align="center" prop="utime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.utime) }}</span>
        </template>
      </el-table-column>
      <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="['system:mzjf:update']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                     v-hasPermi="['system:mzjf:delete']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :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="userId">
          <el-input v-model="form.userId" placeholder="请输入用户ID" />
        </el-form-item>
        <el-form-item label="就诊卡id" prop="cardId">
          <el-input v-model="form.cardId" placeholder="请输入就诊卡id" />
        </el-form-item>
        <el-form-item label="ID" prop="patientid">
          <el-input v-model="form.patientid" placeholder="请输入ID" />
        </el-form-item>
        <el-form-item label="证件类型" prop="idtype">
          <el-select v-model="form.idtype" placeholder="请选择证件类型">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="操作类型" prop="locktype">
          <el-select v-model="form.locktype" placeholder="请选择操作类型">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="检查项目名称" prop="creatitemname">
          <el-input v-model="form.creatitemname" placeholder="请输入检查项目名称" />
        </el-form-item>
        <el-form-item label="预约时间" prop="appointmenttime">
          <el-date-picker clearable v-model="form.appointmenttime" type="date" value-format="timestamp" placeholder="选择预约时间" />
        </el-form-item>
        <el-form-item label="创建时间" prop="creatdate">
          <el-date-picker clearable v-model="form.creatdate" type="date" value-format="timestamp" placeholder="选择创建时间" />
        </el-form-item>
        <el-form-item label="查询方式" prop="querytype">
          <el-select v-model="form.querytype" placeholder="请选择查询方式">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="订单ID" prop="orderno">
          <el-input v-model="form.orderno" placeholder="请输入订单ID" />
        </el-form-item>
        <el-form-item label="单据ID" prop="flowno">
          <el-input v-model="form.flowno" placeholder="请输入单据ID" />
        </el-form-item>
        <el-form-item label="开单科室编号" prop="setdepartcode">
          <el-input v-model="form.setdepartcode" placeholder="请输入开单科室编号" />
        </el-form-item>
        <el-form-item label="开单科室名称" prop="setdepartname">
          <el-input v-model="form.setdepartname" placeholder="请输入开单科室名称" />
        </el-form-item>
        <el-form-item label="执行科室编号" prop="dodepartcode">
          <el-input v-model="form.dodepartcode" placeholder="请输入执行科室编号" />
        </el-form-item>
        <el-form-item label="执行科室名称" prop="dodepartname">
          <el-input v-model="form.dodepartname" placeholder="请输入执行科室名称" />
        </el-form-item>
        <el-form-item label="单据类别" prop="billtype">
          <el-select v-model="form.billtype" placeholder="请选择单据类别">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="单据名称" prop="billname">
          <el-input v-model="form.billname" placeholder="请输入单据名称" />
        </el-form-item>
        <el-form-item label="单据描述" prop="billdes">
          <el-input v-model="form.billdes" placeholder="请输入单据描述" />
        </el-form-item>
        <el-form-item label="开单时间" prop="billtime">
          <el-date-picker clearable v-model="form.billtime" type="date" value-format="timestamp" placeholder="选择开单时间" />
        </el-form-item>
        <el-form-item label="项目总金额" prop="billmoney">
          <el-input v-model="form.billmoney" placeholder="请输入项目总金额" />
        </el-form-item>
        <el-form-item label="医生代码" prop="doctorcode">
          <el-input v-model="form.doctorcode" placeholder="请输入医生代码" />
        </el-form-item>
        <el-form-item label="医生名称" prop="doctorname">
          <el-input v-model="form.doctorname" placeholder="请输入医生名称" />
        </el-form-item>
        <el-form-item label="自费金额" prop="sincemoney">
          <el-input v-model="form.sincemoney" placeholder="请输入自费金额" />
        </el-form-item>
        <el-form-item label="公费金额" prop="fairmoney">
          <el-input v-model="form.fairmoney" placeholder="请输入公费金额" />
        </el-form-item>
        <el-form-item label="开单流水" prop="serialno">
          <el-input v-model="form.serialno" placeholder="请输入开单流水" />
        </el-form-item>
        <el-form-item label="申请单号" prop="appointno">
          <el-input v-model="form.appointno" placeholder="请输入申请单号" />
        </el-form-item>
        <el-form-item label="就诊流水号" prop="serialflowno">
          <el-input v-model="form.serialflowno" placeholder="请输入就诊流水号" />
        </el-form-item>
        <el-form-item label="就诊类别" prop="jzlb">
          <el-input v-model="form.jzlb" placeholder="请输入就诊类别" />
        </el-form-item>
        <el-form-item label="病种类别代码" prop="bzdm">
          <el-input v-model="form.bzdm" placeholder="请输入病种类别代码" />
        </el-form-item>
        <el-form-item label="更新时间" prop="updatedate">
          <el-date-picker clearable v-model="form.updatedate" type="date" value-format="timestamp" placeholder="选择更新时间" />
        </el-form-item>
        <el-form-item label="账单信息" prop="billsmsg">
          <el-input v-model="form.billsmsg" placeholder="请输入账单信息" />
        </el-form-item>
        <el-form-item label="支付签名" prop="paynature">
          <el-input v-model="form.paynature" placeholder="请输入支付签名" />
        </el-form-item>
        <el-form-item label="支付类别" prop="paytype">
          <el-select v-model="form.paytype" placeholder="请选择支付类别">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="支付ID" prop="powertranid">
          <el-input v-model="form.powertranid" placeholder="请输入支付ID" />
        </el-form-item>
        <el-form-item label="支付卡号" prop="powertrancard">
          <el-input v-model="form.powertrancard" placeholder="请输入支付卡号" />
        </el-form-item>
        <el-form-item label="终端ID" prop="terminalid">
          <el-input v-model="form.terminalid" placeholder="请输入终端ID" />
        </el-form-item>
        <el-form-item label="参考号" prop="referno">
          <el-input v-model="form.referno" placeholder="请输入参考号" />
        </el-form-item>
        <el-form-item label="支付金额" prop="zfamount">
          <el-input v-model="form.zfamount" placeholder="请输入支付金额" />
        </el-form-item>
        <el-form-item label="医保金额" prop="ybzhamount">
          <el-input v-model="form.ybzhamount" placeholder="请输入医保金额" />
        </el-form-item>
        <el-form-item label="医保余额" prop="ybtcamount">
          <el-input v-model="form.ybtcamount" placeholder="请输入医保余额" />
        </el-form-item>
        <el-form-item label="医保信息" prop="yboutmsg">
          <el-input v-model="form.yboutmsg" placeholder="请输入医保信息" />
        </el-form-item>
        <el-form-item label="his参考号" prop="hisopernum">
          <el-input v-model="form.hisopernum" placeholder="请输入his参考号" />
        </el-form-item>
        <el-form-item label="工行ID" prop="icbcorderid">
          <el-input v-model="form.icbcorderid" placeholder="请输入工行ID" />
        </el-form-item>
        <el-form-item label="工行支付时间" prop="icbcpaytime">
          <el-date-picker clearable v-model="form.icbcpaytime" type="date" value-format="timestamp" placeholder="选择工行支付时间" />
        </el-form-item>
        <el-form-item label="标志" prop="appFlag">
          <el-input v-model="form.appFlag" placeholder="请输入标志" />
        </el-form-item>
        <el-form-item label="开单状态" prop="appStatus">
          <el-radio-group v-model="form.appStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="提交时间" prop="ctime">
          <el-date-picker clearable v-model="form.ctime" type="date" value-format="timestamp" placeholder="选择提交时间" />
        </el-form-item>
        <el-form-item label="修改时间" prop="utime">
          <el-date-picker clearable v-model="form.utime" type="date" value-format="timestamp" 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>
  </div>
</template>

<script>
import { createMzjf, updateMzjf, deleteMzjf, getMzjf, getMzjfPage, exportMzjfExcel } from "@/api/system/mzjf";

export default {
  name: "Mzjf",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 门诊缴费列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        userId: null,
        patientid: null,
        // idtype: null,
        // locktype: null,
        // creatitemname: null,
        // appointmenttime: [],
        // creatdate: [],
        // querytype: null,
        // orderno: null,
        // flowno: null,
        // setdepartcode: null,
        // setdepartname: null,
        // dodepartcode: null,
        // dodepartname: null,
        // billtype: null,
        // billname: null,
        // billdes: null,
        // billtime: [],
        // billmoney: null,
        // doctorcode: null,
        // doctorname: null,
        // sincemoney: null,
        // fairmoney: null,
        // serialno: null,
        // appointno: null,
        // serialflowno: null,
        // jzlb: null,
        // bzdm: null,
        // updatedate: [],
        // billsmsg: null,
        // paynature: null,
        // paytype: null,
        // powertranid: null,
        // powertrancard: null,
        // terminalid: null,
        // referno: null,
        // zfamount: null,
        // ybzhamount: null,
        // ybtcamount: null,
        // yboutmsg: null,
        // hisopernum: null,
        // icbcorderid: null,
        // icbcpaytime: [],
        // appFlag: null,
        // appStatus: null,
        // ctime: [],
        // utime: [],
        startDate: null,
        endDate: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    const end = new Date();//获取当前的日期
    this.queryParams.startDate=this.dateFormat(end);
    this.queryParams.endDate=this.dateFormat(end);

    this.getList();
  },
  methods: {
    dateFormat(dateData) {
        var date = new Date(dateData)
        var y = date.getFullYear()
        var m = date.getMonth() + 1
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        const time = y + '-' + m + '-' + d;
        return time;
    },    
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 执行查询
      getMzjfPage(this.queryParams).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        userId: undefined,
        cardId: undefined,
        patientid: undefined,
        idtype: undefined,
        locktype: undefined,
        creatitemname: undefined,
        appointmenttime: undefined,
        creatdate: undefined,
        querytype: undefined,
        orderno: undefined,
        flowno: undefined,
        setdepartcode: undefined,
        setdepartname: undefined,
        dodepartcode: undefined,
        dodepartname: undefined,
        billtype: undefined,
        billname: undefined,
        billdes: undefined,
        billtime: undefined,
        billmoney: undefined,
        doctorcode: undefined,
        doctorname: undefined,
        sincemoney: undefined,
        fairmoney: undefined,
        serialno: undefined,
        appointno: undefined,
        serialflowno: undefined,
        jzlb: undefined,
        bzdm: undefined,
        updatedate: undefined,
        billsmsg: undefined,
        paynature: undefined,
        paytype: undefined,
        powertranid: undefined,
        powertrancard: undefined,
        terminalid: undefined,
        referno: undefined,
        zfamount: undefined,
        ybzhamount: undefined,
        ybtcamount: undefined,
        yboutmsg: undefined,
        hisopernum: undefined,
        icbcorderid: undefined,
        icbcpaytime: undefined,
        appFlag: undefined,
        appStatus: undefined,
        ctime: undefined,
        utime: undefined,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加门诊缴费";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getMzjf(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改门诊缴费";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateMzjf(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createMzjf(this.form).then(response => {
          this.$modal.msgSuccess("新增成功");
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
      this.$modal.confirm('是否确认删除门诊缴费编号为"' + id + '"的数据项?').then(function() {
          return deleteMzjf(id);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.$modal.confirm('是否确认导出所有门诊缴费数据项?').then(() => {
          this.exportLoading = true;
          return exportMzjfExcel(params);
        }).then(response => {
          this.$download.excel(response, '门诊缴费.xls');
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>
