<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="title">
        <el-select v-model="queryParams.approveStatus" placeholder="请选择">
          <el-option
            v-for="item in approveStatusList"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
        
      </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-button type="primary" icon="el-icon-s-claim" size="mini" @click="handleGetApplyTpl">获取申请模板</el-button>
        <el-button plain icon="el-icon-plus" size="mini" @click="handleSubmitApply" v-hasPermi="['system:inhospital:add']">提交申请</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="handleSubmitApply"
          v-hasPermi="['system:config: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:config: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:config:remove']"
        >删除</el-button>
      </el-col> -->
     
      
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="姓名" align="center" prop="name" >
        <template slot-scope="scope">
         {{scope.row.name}}
        </template>
      </el-table-column>
      <el-table-column label="性别" align="center" prop="gender" >
        <template slot-scope="scope">
         <div v-if="scope.row.gender == 0">男</div>
         <div v-if="scope.row.gender == 1">女</div>
         <div v-if="scope.row.gender == 2">未知</div>
        </template>
      </el-table-column>
      
      <el-table-column label="手机号" align="center" prop="phone" :show-overflow-tooltip="true" ></el-table-column>
      <el-table-column label="身份证号" align="center" prop="idcard" :show-overflow-tooltip="true" ></el-table-column>
      <el-table-column label="疾病名称" align="center" prop="diseaseName" :show-overflow-tooltip="true" ></el-table-column>
      <el-table-column label="疾病类型" align="center" prop="diseaseTypeName" :show-overflow-tooltip="true" ></el-table-column>
      
      <el-table-column label="入住医院名称" align="center" prop="inHospitalName" :show-overflow-tooltip="true" ></el-table-column>
      
      <el-table-column label="入院时间" align="center" prop="docSrcTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.inHospitalTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="出院时间" align="center" prop="docSrcTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.outHospitalTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="单位名称" align="center" prop="deptName" :show-overflow-tooltip="true" />
      
      <el-table-column label="审批状态" align="center" prop="approveStatusName" :show-overflow-tooltip="true" />
      
      <el-table-column label="申请时间" align="center" prop="docSrcTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="处理时间" align="center" prop="updateTime" :show-overflow-tooltip="true" />
      <!-- <el-table-column label="附件" align="center" prop="baseFileInfos" :show-overflow-tooltip="true" >
        <template slot-scope="scope">
          <div v-for="(item, index) in scope.row.baseFileInfos" :key="index">
            <div v-if="item.isDelete==0">{{ item.fileTypeName }}:{{ item.fileOriginalName }}</div>
          </div>
        </template>
      </el-table-column> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-search"
            @click="handleLook(scope.row)"
            v-hasPermi="['system:config:edit']"
          >查看</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:config:edit']"
            v-if="scope.row.approveStatusName == '待审核'"
          >修改</el-button>
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:config:remove']"
          >删除</el-button> -->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="approve(scope.row)"
            v-hasPermi="['system:config:edit']"
            v-if="scope.row.approveStatusName == '待审核'"
          >审批</el-button>
        </template>
      </el-table-column>
    </el-table>

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

    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :fullscreen="true">
      <el-form ref="form" :model="form" :rules="rules" label-width="180px">
        <el-form-item label="是否住院" prop="status">
          <el-select v-model="form.status" placeholder="是否住院" clearable @change="changeShifouInhospital">
            <el-option
              v-for="dict in dict.type.sys_yes_no"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="所在单位" prop="deptName" v-if="form.status=='Y'">
          <el-input v-model="form.deptName" placeholder="请输入单位名称" />
        </el-form-item>
        <el-form-item label="所在单位编码" prop="deptCode" v-if="form.status=='Y'">
          <el-input v-model="form.deptCode" placeholder="请输入单位名称编码" />
        </el-form-item>
        <el-form-item label="姓名" prop="name" v-if="form.status=='Y'">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="性别" prop="gender" v-if="form.status=='Y'">
          <el-select v-model="form.gender" placeholder="请选择">
            <el-option
              v-for="item in genderList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="身份证号" prop="idcard" v-if="form.status=='Y'">
          <el-input v-model="form.idcard" placeholder="请输入身份证号" />
        </el-form-item>
        <el-form-item label="联系方式" prop="phone" v-if="form.status=='Y'">
          <el-input v-model="form.phone" placeholder="请输入手机号码" />
        </el-form-item>

        <el-divider v-if="form.status=='Y'"></el-divider>
        <el-form-item label="入住医院全称" prop="inHospitalName" v-if="form.status=='Y'">
          <el-input v-model="form.inHospitalName" placeholder="请输入入住医院全称" />
        </el-form-item>
        <el-form-item label="住院日期" prop="inHospitalTime" v-if="form.status=='Y'">
          <el-date-picker
          type="datetime"
            v-model="form.inHospitalTime"
            style="width: 240px"
            format="yyyy-MM-dd HH:mm:ss"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择"
          ></el-date-picker>
        
        </el-form-item>
        <el-form-item label="出院日期" prop="outHospitalTime" v-if="form.status=='Y'">
          <el-date-picker
          type="datetime"
            v-model="form.outHospitalTime"
            style="width: 240px"
            format="yyyy-MM-dd HH:mm:ss"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择"
          ></el-date-picker>
        
        </el-form-item>
        <el-form-item label="所患疾病类型" prop="diseaseType" v-if="form.status=='Y'">
          <el-select v-model="form.diseaseType" placeholder="请选择">
            <el-option
              v-for="item in diseaseTypeNameList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所患疾病" prop="diseaseCode" v-if="form.status=='Y'">
          <el-select v-model="form.diseaseCode" placeholder="请选择">
            <el-option
              v-for="item in diseaseNameList"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue">
            </el-option>
          </el-select>
        </el-form-item>
        <el-divider v-if="form.status=='Y'"></el-divider>
        
        <el-form-item label="会员住院慰问申请表" prop="content" v-if="form.status=='Y'">
          <el-upload
            name="zywwsqbFiles"
            :action="uploadUrl"
            :data="uploadData"
            :headers="headers"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
            :on-success="handleUploadSuccess">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="会员住院慰问金汇总申请表" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="基层工会慰问申请表" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="工会会员在职证明" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="公示" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="身份证复印件" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="工会会员卡复印件" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="住院病案首页复印件" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="诊断证明复印件" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="工伤证明（仅限工伤非必填）" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item label="手术记录（仅限部分疾病非必填）" prop="content" v-if="form.status=='Y'">
          <el-upload
            :action="uploadUrl"
            :data="uploadData"
            list-type="picture-card"
            :before-upload="beforeUploadFun"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove">
            <i class="el-icon-plus"></i>
          </el-upload>
        </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="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt="">
    </el-dialog>
    <el-dialog title="获取申请模板" :visible.sync="openApplyTpl" width="800px" append-to-body >
      <el-form ref="formApplyTpl" :model="formApplyTpl" :rules="rulesApplyTpl" label-width="120px">
        <el-form-item label="所患疾病" prop="status">
          <el-select v-model="formApplyTpl.status" placeholder="所患疾病" clearable>
            <el-option
              v-for="dict in dict.type.sys_normal_disable"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="个人外网邮箱" prop="email">
          <el-input v-model="formApplyTpl.email" placeholder="请输入个人外网邮箱" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormApplyTpl">确 定</el-button>
        <el-button @click="cancelApplyTpl">取 消</el-button>
      </div>
    </el-dialog>

    <el-drawer
      title="查看"
      :visible.sync="drawer"
      direction="rtl" size='50%'>
      <div style="margin:20px;">
        <look :form="form"/>
      </div>
        <el-button @click="cancelLook" style="margin-left: 20px;margin-bottom: 20px;">关 闭</el-button>
    </el-drawer>
  </div>
</template>

<script>
import { list, getConfig, del, add, saveOrUpdate, refreshCache, sendEmail, doApprove, cancelUpload } from "@/api/business/inhospital";
import { listByDictType } from "@/api/business/studyhelper";
import look from "./look";
import { v4 as uuidv4 } from 'uuid';
import { getToken } from "@/utils/auth";
export default {
  name: "Config",
  dicts: ['sys_yes_no','sys_normal_disable'],
  components:{look},
  data() {
    return {
      dialogVisible: false,
      dialogImageUrl: '',
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 参数表格数据
      configList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openApplyTpl:false, 
      drawer: false, 
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        pageIndex: 1,
        pageSize: 10,
        title: undefined,
        datasourceName: undefined,
        approveStatus: 0
      },
      // 表单参数
      form: {
        // isTop: '0', 
        // orderNum: '0',
        docId: null,
        url: '',
        content: '',
        applyFormId: ""
      },
      // 表单校验
      rules: {
        deptName: [
          { required: true, message: "单位名称不能为空", trigger: "blur" }
        ],
        
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ]
        ,
        gender: [
          { required: true, message: "性别不能为空", trigger: "blur" }
        ],
        idcard: [
          { required: true, message: "身份证号不能为空", trigger: "blur" }
        ],
        phone: [
          { required: true, message: "手机号不能为空", trigger: "blur" }
        ],
        inHospitalName: [
          { required: true, message: "入住医院全称不能为空", trigger: "blur" }
        ],
        inHospitalTime:[
          { required: true, message: "入院时间不能为空", trigger: "blur" }
        ],
        outHospitalTime:[
          { required: true, message: "出院时间不能为空", trigger: "blur" }
        ],
        diseaseType:[
          { required: true, message: "所患疾病类型不能为空", trigger: "blur" }
        ],
        diseaseCode: [
          { required: true, message: "所患疾病不能为空", trigger: "blur" }
        ]
      },
      rulesApplyTpl:{
        email: [
          { required: true, message: "个人外网邮箱不能为空", trigger: "blur" }
        ]
      },
      formApplyTpl:{
        email: null,
        docId: null
      },
      approveStatusList:[{
        label: '待审批',
        value: 0
      },
      // {
      //   label: '审批中',
      //   value: 3
      // },
      {
        label: '已审批',
        value: 1
      }],
      genderList:[{
        label: '男',
        value: 0
      },{
        label: '女',
        value: 1
      },{
        label: '未知',
        value: 3
      }],
      uploadUrl: process.env.VUE_APP_BASE_API + '/api/base/upload',
      uploadData: {"moduleCode":"zyww", "applyFormId": ""},
      headers: {
        Authorization: "Bearer " + getToken()
      },
      diseaseTypeNameList:[],
      diseaseNameList:[]
    };
  },
  created() {
    let that = this;
    this.getDicts('first_disease',function(datas){
      that.diseaseTypeNameList = datas;
    });
    this.getDicts('sqjzbz_disease',function(datas){
      that.diseaseNameList = datas;
    });
    this.getList();
    // this.configList  = [{
    //         name: 'aaa'
    //       }]
          this.loading = false
    // this.form = {
    //     title: '测试',
    //     url: 'www.baidu.com',
    //     content: '<p><b>aaaaa</b></p>'
    //   }
  },
  methods: {
    getDicts(study_datasource_type, callback){
      listByDictType(study_datasource_type).then(response => {
          callback(response.data);
        }
        );
    },
    handleUploadSuccess(res, file) {
      console.log(res)
      // 如果上传成功
      if (res.code == 200) {
        // res.data
      }
    },
    beforeUploadFun(file){
      return true;
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
      console.log('删除文件')
      let id = file.response.data;
      cancelUpload({
        "fileStorageId": id
      }).then(response => {
        console.log(response)
        this.$modal.msgSuccess(response.data?"删除文件成功":"删除文件失败");
      });
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    changeShifouInhospital(val){
      if(val == 'Y'){

      }else{
        this.$alert('因不符合重病住院关爱慰问要求，未住院会员无法申报此项慰问金', '说明', {
          confirmButtonText: '确定',
          callback: action => {
            
          }
        });
      }
    },
    handleSubmitApply(){
      this.open = true;
      this.$alert('对符合慰问条件，患本办法规定范围内的38种指定重大疾病且每年首次住院的工会会员，给予一次性2000元慰问金，对每年首次因其他疾病住院的工会会员给予500元慰问金。', '说明', {
          confirmButtonText: '确定',
          callback: action => {
            
          }
        });
         this.form.applyFormId = uuidv4();
         this.uploadData['applyFormId'] = this.form.applyFormId
    },
    /** 查询参数列表 */
    getList() {
      this.loading = true;
      if(this.queryParams.approveStatus == 0){
        this.queryParams. type = 'approve'
      }else{
        this.queryParams. type = 'apply'
      }
      list(this.queryParams).then(response => {
          this.configList = response.data.records;
          
          this.total = response.data.total;
          this.loading = false;
        }
        );
      
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        docId: undefined,
        title: undefined,
        
        url: undefined,
        content: undefined,
        // isTop: '0', 
        // orderNum: '0'
      };
      this.resetForm("form");
    },
    handleGetApplyTpl(){
      this.openApplyTpl = true;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageIndex = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加";
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.configId)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const configId = row.docId
      // getDetail(configId).then(response => {
        // this.form = response.data;
        this.form  = row;
        this.form.status = 'Y'
        this.open = true;
        this.title = "修改";
         this.uploadData['applyFormId'] = this.form.applyFormId
      // });
    },
    
    handleLook(row){
      this.drawer = true;
      this.form =row;
    },
    cancelLook(){
      this.drawer = false;
      this.form = {}
    },
    submitFormApplyTpl(){
      this.$refs["formApplyTpl"].validate(valid => {
        if (valid) {
          if (this.form.docId != undefined) {
            sendEmail({
              toEmail:this.formApplyTpl.email,
              moduleCode: 'zyww' //住院慰问
            }).then(response => {
              this.$modal.msgSuccess(response.data);
              this.openApplyTpl = false;
              // this.getList();
            });
      
            
          }
        }
      });
    },
    cancelApplyTpl(){
      this.openApplyTpl = false;
      this.formApplyTpl.docId = null;
      this.formApplyTpl.email = null;
    },
    /** 提交按钮 */
    submitForm: function() {
      let that = this;
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.diseaseTypeName = this.diseaseTypeNameList.filter(item => item.dictValue == this.form.diseaseType)[0].dictLabel
          this.form.diseaseName = this.diseaseNameList.filter(item => item.dictValue == this.form.diseaseCode)[0].dictLabel
          saveOrUpdate(this.form).then(response => {
            if(response.data){
              this.$modal.msgSuccess(that.form.applyFormId ? "修改成功":"新增成功");
              this.open = false;
              this.getList();
            }else{
              this.$modal.msgSuccess(that.form.applyFormId ? "修改失败":"新增失败");
            }
              
            });
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      // const configIds = row.id || this.ids;
      this.$modal.confirm('是否确认删除该条记录？').then(function() {
          return del({
            docId: row.docId
          });
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/config/export', {
        ...this.queryParams
      }, `config_${new Date().getTime()}.xlsx`)
    },
    /** 刷新缓存按钮操作 */
    handleRefreshCache() {
      refreshCache().then(() => {
        this.$modal.msgSuccess("刷新成功");
      });
    },
    approve(row){
      let that = this;
      this.$confirm('请确认该条信息是否通过审核?', '提示', {
        distinguishCancelAndClose: true,
        confirmButtonText: '通过',
        cancelButtonText: '不通过',
      }).then(() => {
        doApprove({
          applyFormId: row.applyFormId,
          optFlag:1
        }).then(res=>{
          this.$modal.msgSuccess(res.data? "审批成功":"审批失败");
          this.getList();
        })
      }).catch(action  => {
        if(action == 'cancel'){
          doApprove({
            applyFormId: row.applyFormId,
            optFlag:2
          }).then(res=>{
            this.$modal.msgSuccess(res.data? "审批成功":"审批失败");
            this.getList();
          })
        }
        
      })
      
    }
  }
};
</script>
