<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="serial">
        <el-input
          v-model="queryParams.serial"
          placeholder="请输入序列号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="仪器名称" prop="instrumentIdArray">
        <el-select
          v-model="queryParams.instrumentIdArray"
          placeholder="请选择类型"
          multiple
          :style="{ width: '100%' }"
          clearable
        >
          <el-option
            v-for="item in instrumentList"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="绑定状态" prop="bindingStatus">
        <el-select
          v-model="queryParams.bindingStatus"
          placeholder="请选择状态"
          :style="{ width: '100%' }"
          clearable
        >
          <el-option label="全部" value="" />
          <el-option label="已绑定" value="0" />
          <el-option label="未绑定" value="1" />
          <el-option label="已解绑" value="1" />
        </el-select>
      </el-form-item>
      <el-form-item label="有效状态" prop="validStatus">
        <el-select
          v-model="queryParams.validStatus"
          placeholder="请选择状态"
          :style="{ width: '100%' }"
          clearable
        >
          <el-option label="全部" value="" />
          <el-option label="有效" value="1" />
          <el-option label="无效" value="0" />
        </el-select>
      </el-form-item>
      <el-form-item label="来源" prop="source">
        <el-input
          v-model="queryParams.source"
          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-select v-model="batchOperateValue" placeholder="批量操作" size="mini" clearable>
          <el-option label="导出数据" :value="1"></el-option>
          <el-option label="导出全量数据" :value="2"></el-option>
          <el-option label="批量导入序列号创建" :value="3"></el-option>
          <el-option label="删除批量数据" :value="4"></el-option>
          <el-option label="删除全量数据" :value="5"></el-option>
          <el-option label="修改批量数据" :value="6"></el-option>
          <el-option label="修改全量数据" :value="7"></el-option>
        </el-select>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-warning"
          size="mini"
          @click="batchOperate()"
        >确认
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:instrumentSerial: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:instrumentSerial: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:instrumentSerial: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="['system:instrumentSerial:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="serialList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="序列号" align="center" prop="serial" />
      <el-table-column label="仪器" align="center" prop="instrumentName" />
      <el-table-column label="绑定状态" align="center" prop="bindingStatus" >
        <template slot-scope="scope">
          <span v-show="scope.row.bindingStatus == 0">已绑定</span>
          <span v-show="scope.row.bindingStatus == 1">未绑定</span>
          <span v-show="scope.row.bindingStatus == 2">已解绑</span>
        </template>
      </el-table-column>
      <el-table-column label="有效状态" align="center" prop="validStatus" >
        <template slot-scope="scope">
          <span v-show="scope.row.validStatus == 0">无效</span>
          <span v-show="scope.row.validStatus == 1">有效</span>
        </template>
      </el-table-column>
      <el-table-column label="来源" align="center" prop="source" />
      <el-table-column label="创建时间" align="center" prop="createTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</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:instrumentSerial:edit']"
          >编辑</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="detailShow(scope.row)"
            v-hasPermi="['system:instrumentSerial:remove']"
          >绑定记录</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-share"
            @click="codeShow(scope.row)"
            v-hasPermi="['system:instrumentSerial: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="instrumentId">-->
<!--          <el-input v-model="form.instrumentId" placeholder="请输入仪器id" />-->
<!--        </el-form-item>-->
        <el-form-item label="仪器型号" prop="instrumentId">
          <el-select :disabled="isDisabled(form)"
            v-model="form.instrumentId"
            placeholder="请选择型号"
            :style="{ width: '100%' }"
            clearable
          >
            <el-option
              v-for="item in instrumentList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="序列号" prop="serial" >
          <el-input v-model="form.serial" placeholder="请输入序列号" :disabled="isDisabled(form)" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50"/>
        </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 :title="title" :visible.sync="importVisible" width="500px" append-to-body>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="模板下载" prop="serial" >
          <el-button
            type="primary"
            plain
            @click="importTemplate"
          >点击下载
          </el-button>
        </el-form-item>
        <el-form-item label="模板上传" prop="serial" >
          <el-upload
            ref="upload"
            :limit="1"
            accept=".xls, .xlsx"
            :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" slot="tip">只能上传.xls,.xlsx 文件</div>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">导 入</el-button>
        <el-button @click="importCancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 详情记录对话框 -->
    <el-dialog :title="detailTitle" :visible.sync="detailOpen" width="880px" append-to-body>
      <el-table v-loading="loading" :data="userInstrumentLogList">
        <el-table-column label="序号" align="center" prop="id" />
        <el-table-column label="会员昵称" align="center" prop="wxUserMember.nickName" />
        <el-table-column label="手机号码" align="center" prop="wxUserMember.mobile" />
        <el-table-column label="用户编号" align="center" prop="wxUserMember.id" />
        <el-table-column label="仪器名称" align="center" prop="instrumentName" />
        <el-table-column label="仪器序列号" align="center" prop="serial" />
        <el-table-column label="类型" align="center" prop="bindingStatus" >
          <template slot-scope="scope">
            <span v-show="scope.row.bindingStatus == 0">已绑定</span>
            <span v-show="scope.row.bindingStatus == 1">未绑定</span>
            <span v-show="scope.row.bindingStatus == 2">已解绑</span>
          </template>
        </el-table-column>
        <el-table-column label="操作时间" align="center" prop="createTime" >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
          </template>
        </el-table-column>
      </el-table>

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

    <!-- 二维码-->
    <el-dialog :title="codeTitle" :visible.sync="codeOpen" width="780px" append-to-body>
        <div class="demo-image__lazy">
          <el-image :key="codeUrl" :src="codeUrl" :preview-src-list="[codeUrl]" lazy></el-image>
        </div>
    </el-dialog>
    <!-- 导出字段选择弹窗   -->
    <el-dialog title="自定义导出字段" :visible.sync="exportFieldsVisible" width="50%"
               :before-close="cancelExportFieldsDialog">
      <el-form ref="form" label-width="150px">
        <el-form-item label="全部字段" prop="allFields">
          <el-switch v-model="allFields" @click.native="isExportAllFields()"/>
        </el-form-item>
      </el-form>
      <el-form :inline="true" ref="form" :model="exportFieldList" label-width="150px">
        <el-form-item label="序号 " prop="nickname">
          <el-switch v-model="exportFieldList.id" :active-value="'id'" :inactive-value="null"/>
        </el-form-item>
        <el-form-item label="仪器 " prop="instrumentName">
          <el-switch v-model="exportFieldList.instrumentName" active-value="instrumentName" :inactive-value="null"/>
        </el-form-item>
        <el-form-item label="来源 " prop="source">
          <el-switch v-model="exportFieldList.source" active-value="source" :inactive-value="null"/>
        </el-form-item>
        <el-form-item label="序列号 " prop="serial">
          <el-switch v-model="exportFieldList.serial" active-value="serial" :inactive-value="null"/>
        </el-form-item>
        <el-form-item label="有效状态 " prop="validStatus">
          <el-switch v-model="exportFieldList.validStatus" active-value="validStatus" :inactive-value="null"/>
        </el-form-item>
        <el-form-item label="创建时间 " prop="createTime">
          <el-switch v-model="exportFieldList.createTime" active-value="createTime" :inactive-value="null"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelExportFieldsDialog()">取 消</el-button>
        <el-button type="primary" @click="submitBatchOperate">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog title="修改状态" :visible.sync="validStatusVisible" width="400px">
      <div style="margin-left: 10%" >
        <el-radio v-model="updateValidStatusForm.validStatus" label="1">有效</el-radio>
        <el-radio v-model="updateValidStatusForm.validStatus" label="0">无效</el-radio>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelUpdateStatusDialog()">取 消</el-button>
        <el-button type="primary" @click="submitBatchOperate">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import { listSerial, getSerial, delSerial, addSerial, updateSerial,delSerialAll,updateStatus } from "@/api/system/instrumentSerial";
import {listInstrument} from "@/api/system/instrument";
import {getToken} from "@/utils/auth";
import {listLog} from "@/api/system/userInstrumentLog"

export default {
  name: "Serial",
  data() {
    return {
      codeUrl: "",
      // 二维码标题
      codeTitle: "二维码",
      // 二维码弹窗
      codeOpen: false,
      // 详情标题
      detailTitle: "记录详情",
      // 详情弹窗
      detailOpen: false,
      // 用户仪器绑定日记表格数据
      userInstrumentLogList: [],
      // 仪器列表
      instrumentList: [],
      // 有效无效展示框
      validStatusVisible: false,
      // 导入展示框
      importVisible: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      logTotal: 0,
      // 仪器序列号关联表格数据
      serialList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      batchOperateValue: null,
      // 字段隐藏
      exportFieldsVisible : false,
      allFields: false,
      // 需要导出的字段
      exportFieldList: {
        id: null,
        instrumentName: null,
        source: null,
        serial: null,
        validStatus: null,
        createTime: null,
      },
      exportFieldsForm: {
        instrumentSerialIdList: null,
        exportFields: null,
      },
      queryLogParams: {
        pageNum: 1,
        pageSize: 10,
        userInstrumentId: null,
      },
      updateValidStatusForm: {
        validStatus: "1",
        instrumentSerialIdList: null,
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        instrumentId: null,
        source: null,
        instrumentName: null,
        serial: null,
        bindingStatus: null,
        validStatus: null,
        status: null,
        instrumentIdArray: null,
      },
      // 导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/instrumentSerial/importData"
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        instrumentId: [
          { required: true, message: "仪器名称不能为空", trigger: "blur" }
        ],
        instrumentName: [
          { required: true, message: "仪器名称不能为空", trigger: "blur" }
        ],
        serial: [
          { required: true, message: "序列号不能为空", trigger: "blur" }
        ],
        bindingStatus: [
          { required: true, message: "绑定状态，1未绑定，2已解绑不能为空", trigger: "change" }
        ],
        validStatus: [
          { required: true, message: "序列号有效状态，1有效，0无效不能为空", trigger: "change" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.queryInstrument();
  },
  methods: {
    isDisabled(row){
      if (row.id) {
        return true;
      }
      return false
    },
    queryInstrument(){
      listInstrument({}).then(response => {
        this.instrumentList = response.rows;
      });
    },
    /** 查询仪器序列号关联列表 */
    getList() {
      this.loading = true;
      listSerial(this.queryParams).then(response => {
        this.serialList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    importCancel(){
      this.importVisible = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        instrumentId: null,
        instrumentName: null,
        serial: null,
        bindingStatus: null,
        validStatus: null,
        status: null,
        createBy: null,
        createTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 展示详情 */
    detailShow(row){
      this.queryLogParams.serial = row.serial;
      listLog(this.queryLogParams).then(response => {
        this.detailOpen = true;
        this.userInstrumentLogList = response.rows;
        this.logTotal = response.total;
      });

    },
    /** 搜索按钮操作 */
    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.reset();
      const id = row.id || this.ids
      getSerial(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改仪器序列号关联";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSerial(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSerial(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除仪器序列号关联编号为"' + ids + '"的数据项？').then(function() {
        return delSerial(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/serial/export', {
        ...this.queryParams
      }, `serial_${new Date().getTime()}.xlsx`)
    },
    codeShow(row){
      this.codeUrl = process.env.VUE_APP_BASE_API + '/system/qrcode/create?serial=' + row.serial;
      this.codeOpen = true;
    },
    // 批量操作
    batchOperate() {
      if (this.batchOperateValue == null) {
        this.$message.error("请选择您的操作");
        return;
      }
      if (this.batchOperateValue == 1) {
        if (this.ids.length == 0) {
          this.$message.error("请选择数据");
          return
        }
        this.exportFieldsVisible = true;
      }
      if (this.batchOperateValue == 2) {
        this.exportFieldsVisible = true;
      }
      if (this.batchOperateValue == 3) {
        this.importVisible = true;
      }
      if (this.batchOperateValue == 4) {
        if (this.ids.length == 0) {
          this.$message.error("请选择数据");
          return
        }
        const ids =  this.ids;
        this.$modal.confirm('确定将选择的数据删除？【请谨慎操作，一旦成功将无法撤销】').then(function() {
          return delSerial(ids);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      }
      if (this.batchOperateValue == 5) {
        this.$modal.confirm('确定将【全量】的数据删除？【请谨慎操作，一旦成功将无法撤销】').then(function() {
          return delSerialAll();
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      }
      if (this.batchOperateValue == 6 ) {
        if (this.ids.length == 0) {
          this.$message.error("请选择数据");
          return
        }
        this.validStatusVisible = true;
      }
      if (this.batchOperateValue == 7 ) {
        this.validStatusVisible = true;
      }
    },
    // 取消操作
    cancelExportFieldsDialog() {
      this.allFields = false;
      this.exportFieldsVisible = false
      this.exportFieldList = {
        id: null,
        instrumentName: null,
        source: null,
        serial: null,
        validStatus: null,
        createTime: null,
      }
    },
    // 批量操作
    submitBatchOperate() {
      // 导出用户数据
      if (this.batchOperateValue == 1) {
        let exportFields = Object.values(this.exportFieldList).filter(val => val != null);
        if (exportFields.length == 0) {
          this.$modal.msgError("请选择导出字段");
          return;
        }
        this.exportFieldsForm.instrumentSerialIdList = this.ids;
        this.exportFieldsForm.exportFields = exportFields;
        this.download('/system/instrumentSerial/batchExport', {
          ...this.exportFieldsForm
        }, `仪器序列号_${new Date().getTime()}.xlsx`);
        this.cancelExportFieldsDialog();
      }
      if (this.batchOperateValue == 2) {
        let exportFields = Object.values(this.exportFieldList).filter(val => val != null);
        if (exportFields.length == 0) {
          this.$modal.msgError("请选择导出字段");
          return;
        }
        this.queryParams.instrumentSerialIdList = null;
        this.queryParams.exportFields = exportFields;
        this.download('/system/instrumentSerial/batchExport', {
          ...Object.assign({}, this.queryParams, {exportFields: exportFields})
        }, `仪器序列号_${new Date().getTime()}.xlsx`)
        this.cancelExportFieldsDialog();
      }

      if (this.batchOperateValue == 6) {
        this.updateValidStatusForm.instrumentSerialIdList = this.ids;
        updateStatus(this.updateValidStatusForm).then(response => {
          this.$modal.msgSuccess("更新成功");
          this.validStatusVisible = false;
          this.getList();
        });
      }
      if (this.batchOperateValue == 7) {
        this.updateValidStatusForm.instrumentSerialIdList = null;
        updateStatus(this.updateValidStatusForm).then(response => {
          this.$modal.msgSuccess("更新成功");
          this.validStatusVisible = false;
          this.getList();
        });
      }
    },
    isExportAllFields() {
      if (this.allFields) {
        this.exportFieldList.instrumentName = "instrumentName";
        this.exportFieldList.id = "id";
        this.exportFieldList.source = "source";
        this.exportFieldList.validStatus = "validStatus";
        this.exportFieldList.serial = "serial";
        this.exportFieldList.createTime = "createTime";
      } else {
        this.exportFieldList.instrumentName = null;
        this.exportFieldList.id = null;
        this.exportFieldList.source = null;
        this.exportFieldList.serial = null;
        this.exportFieldList.validStatus = null;
        this.exportFieldList.createTime = null;
      }
    },
    // 关闭弹窗
    cancelUpdateStatusDialog (){
      this.validStatusVisible = false;
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList, item) {
      this.importVisible = 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();
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('system/instrumentSerial/importTemplate', {
      }, `仪器序列号模板_${new Date().getTime()}.xlsx`)
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    }
  }
};
</script>
