<template>
  <div>
    <!-- 顶部黑色标题部分 -->
    <el-row>
      <el-col
        :span="24"
        class="first-row"
      >
        <div class="tag">应急储备</div>
      </el-col>
    </el-row>
    <!-- 顶部空白部分 -->
    <el-row>
      <el-col
        :span="24"
        class="second-row"
      > </el-col>
    </el-row>
    <!-- 顶部分割线部分 -->
    <hr style="background-color: #cccccc; height: 1px; border: 0" />
    <!-- 主体部分 -->
    <el-tabs type="border-card">
      <!-- 应急队伍选项部分 -->
      <el-tab-pane label="应急队伍">
        <el-row>
          <!-- 应急队伍选项按钮部分 -->
          <el-col
            :span="16"
            class="third-row"
          >
            <el-upload
              class="upload-demo"
              action="none"
              accept=".xls,.xlsx"
              :auto-upload="false"
              :limit="1"
              :on-exceed="handleExceed"
              :before-remove="beforeRemove"
              :on-change="checkType"
            >
              <el-button
                class="btnupload"
                slot="trigger"
                size="small"
                type="primary"
              >应急队伍表格导入
              </el-button>
              <el-button
                class="btnupload"
                style="margin-left: 10px"
                size="small"
                type="success"
                @click="submitUpload"
              >上传到服务器
              </el-button>
              <div
                slot="tip"
                class="el-upload__tip"
              >
                只能上传xls/xlsx文件，且不超过2MB
              </div>
            </el-upload>
            <el-link
              type="primary"
              icon="el-icon-download"
              href="../dist/static/model/emergencyTeam.xlsx"
            >模板下载</el-link>
          </el-col>
          <el-col
            :span="8"
            class=""
          >
            <el-button
              type="primary"
              @click="
                dialogFormVisible_team = true;
                form3 = {};
              "
            >新增应急队伍</el-button>
          </el-col>
        </el-row>
        <!-- 新增应急队伍弹窗 -->
        <el-dialog
          title="新增应急队伍"
          :visible.sync="dialogFormVisible_team"
        >
          <el-form
            :model="form3"
            label-width="auto"
            :rules="rules3"
            ref="form3"
          >
            <el-form-item
              label="队伍名称"
              prop="teamName"
            >
              <el-input v-model="form3.teamName"></el-input>
            </el-form-item>
            <el-form-item
              label="队伍数量"
              prop="teamNum"
            >
              <el-input v-model="form3.teamNum"></el-input>
            </el-form-item>
            <el-form-item
              label="队伍人数"
              prop="teamNumOfPeople"
            >
              <el-input v-model="form3.teamNumOfPeople"></el-input>
            </el-form-item>
          </el-form>
          <div
            slot="footer"
            class="dialog-footer"
          >
            <el-button
              type="primary"
              @click="addTeams('form3')"
            >确 定</el-button>
            <el-button @click="dialogFormVisible_team = false">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 应急队伍选项分割线部分 -->
        <hr style="background-color: #cccccc; height: 1px; border: 0" />
        <!-- 应急队伍选项表格部分 -->
        <el-row>
          <el-col
            :span="24"
            class="third-row"
          >
            <!-- 应急队伍表单 -->
            <el-table
              v-loading="loading"
              element-loading-text="加载中"
              element-loading-spinner="el-icon-loading"
              :data="tableData"
              ref="tableList"
              style="width: 100%; font-size: 14px"
              highlight-current-row
            >
              <el-table-column
                prop="teamName"
                label="队伍名称"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="teamNum"
                label="队伍数量"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="teamNumOfPeople"
                label="队伍人数"
                align="center"
              >
              </el-table-column>

              <el-table-column
                label="操作"
                align="center"
                width="350"
              >
                <template slot-scope="{ row }">
                  <el-button
                    type="warning"
                    @click="amendTeams(row)"
                  >修改</el-button>
                  <el-button
                    type="danger"
                    @click="deleteTeams(row.id)"
                  >删除</el-button>
                  <el-button
                    type="danger"
                    @click="showPop(row.id)"
                  >查看详情</el-button>
                </template>
              </el-table-column>
            </el-table>
            <!-- 修改应急队伍弹窗 -->
            <el-dialog
              title="修改应急队伍"
              :visible.sync="dialogFormVisible_team2"
            >
              <el-form
                :model="form3"
                label-width="auto"
                :rules="rules3"
                ref="form3_amend"
              >
                <el-form-item
                  label="队伍名称"
                  prop="teamName"
                >
                  <el-input v-model="form3.teamName"></el-input>
                </el-form-item>
                <el-form-item
                  label="队伍数量"
                  prop="teamNum"
                >
                  <el-input v-model="form3.teamNum"></el-input>
                </el-form-item>
                <el-form-item
                  label="队伍人数"
                  prop="teamNumOfPeople"
                >
                  <el-input v-model="form3.teamNumOfPeople"></el-input>
                </el-form-item>
              </el-form>
              <div
                slot="footer"
                class="dialog-footer"
              >
                <el-button
                  type="primary"
                  @click="hangdleAmendTeams('form3_amend')"
                >确 定</el-button>
                <el-button @click="dialogFormVisible_team2 = false">取 消</el-button>
              </div>
            </el-dialog>
            <!-- 分页器 -->
            <div class="pages">
              <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :page-sizes="[10, 20, 50, 100]"
                :current-page="currentPage"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
              >
              </el-pagination>
            </div>
          </el-col>
        </el-row>
      </el-tab-pane>
      <!-- 防疫物资选项部分 -->
      <el-tab-pane label="防疫物资">
        <!-- 防疫物资选项按钮部分 -->
        <el-row>
          <el-col
            :span="16"
            class="third-row"
          >
            <el-upload
              class="upload-demo"
              action="none"
              accept=".xls,.xlsx"
              :auto-upload="false"
              :limit="1"
              :on-exceed="handleExceed"
              :before-remove="beforeRemove"
              :on-change="checkType2"
            >
              <el-button
                class="btnupload"
                slot="trigger"
                size="small"
                type="primary"
              >防疫物资表格导入</el-button>
              <el-button
                class="btnupload"
                style="margin-left: 10px"
                size="small"
                type="success"
                @click="submitUpload2"
              >上传到服务器
              </el-button>
              <div
                slot="tip"
                class="el-upload__tip"
              >
                只能上传xls/xlsx文件，且不超过2MB
              </div>
            </el-upload>
            <el-link
              type="primary"
              icon="el-icon-download"
              href="../dist/static/model/antiepidemicGoods.xlsx"
            >模板下载</el-link>
          </el-col>
          <el-col
            :span="8"
            class=""
          >
            <el-button
              type="primary"
              @click="
                dialogFormVisible_good = true;
                form = {};
              "
            >新增防疫物资</el-button>
          </el-col>
          <!-- 新增防疫物资弹窗 -->
          <el-dialog
            title="新增防疫物资"
            :visible.sync="dialogFormVisible_good"
          >
            <el-form
              :model="form"
              label-width="auto"
              :rules="rules"
              ref="form"
            >
              <el-form-item
                label="物资种类"
                prop="type"
              >
                <el-input v-model="form.type"></el-input>
              </el-form-item>
              <el-form-item
                label="物资名称"
                prop="suppliesName"
              >
                <el-input v-model="form.suppliesName"></el-input>
              </el-form-item>
              <el-form-item
                label="现有储备（件）"
                prop="suppliesNum"
              >
                <el-input v-model="form.suppliesNum"></el-input>
              </el-form-item>
              <el-form-item
                label="储备要求（件）"
                prop="suppliesRequireNum"
              >
                <el-input v-model="form.suppliesRequireNum"></el-input>
              </el-form-item>
            </el-form>
            <div
              slot="footer"
              class="dialog-footer"
            >
              <el-button
                type="primary"
                @click="addGoods('form')"
              >确 定</el-button>
              <el-button @click="dialogFormVisible_good = false">取 消</el-button>
            </div>
          </el-dialog>
        </el-row>
        <!-- 防疫物资选项分割线部分 -->
        <hr style="background-color: #cccccc; height: 1px; border: 0" />
        <!-- 防疫物资选项表格部分 -->
        <el-row>
          <el-col
            :span="24"
            class="third-row"
          >
            <!-- 防疫物资表单 -->
            <el-table
              v-loading="loading2"
              element-loading-text="加载中"
              element-loading-spinner="el-icon-loading"
              :data="tableData2"
              ref="tableList"
              style="width: 100%; font-size: 14px"
              highlight-current-row
            >
              <el-table-column
                prop="type"
                label="物资种类"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="suppliesName"
                label="物资要求"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="suppliesNum"
                label="现有储备（件）"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="suppliesRequireNum"
                label="储备要求（件）"
                align="center"
              >
              </el-table-column>

              <el-table-column
                label="操作"
                align="center"
                width="300"
              >
                <template slot-scope="{ row }">
                  <el-button
                    type="warning"
                    @click="amendGoods(row)"
                  >修改</el-button>
                  <el-button
                    type="danger"
                    @click="deleteGoods(row.id)"
                  >删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <!-- 修改防疫物资弹窗 -->
            <el-dialog
              title="修改防疫物资"
              :visible.sync="dialogFormVisible_good2"
            >
              <el-form
                :model="form"
                label-width="auto"
                :rules="rules"
                ref="form_amend"
              >
                <el-form-item
                  label="物资种类"
                  prop="type"
                >
                  <el-input v-model="form.type"></el-input>
                </el-form-item>
                <el-form-item
                  label="物资名称"
                  prop="suppliesName"
                >
                  <el-input v-model="form.suppliesName"></el-input>
                </el-form-item>
                <el-form-item
                  label="现有储备（件）"
                  prop="suppliesNum"
                >
                  <el-input v-model="form.suppliesNum"></el-input>
                </el-form-item>
                <el-form-item
                  label="储备要求（件）"
                  prop="suppliesRequireNum"
                >
                  <el-input v-model="form.suppliesRequireNum"></el-input>
                </el-form-item>
              </el-form>
              <div
                slot="footer"
                class="dialog-footer"
              >
                <el-button
                  type="primary"
                  @click="hangdleAmendGoods('form_amend')"
                >确 定</el-button>
                <el-button @click="dialogFormVisible_good2 = false">取 消</el-button>
              </div>
            </el-dialog>
            <!-- 分页器 -->
            <div class="pages">
              <el-pagination
                background
                @size-change="handleSizeChange2"
                @current-change="handleCurrentChange2"
                :page-sizes="[10, 20, 50, 100]"
                :current-page="currentPage2"
                :page-size="pageSize2"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total2"
              >
              </el-pagination>
            </div>
          </el-col>
        </el-row>
      </el-tab-pane>
      <!-- 隔离场所选项部分 -->
      <el-tab-pane label="隔离场所">
        <!-- 隔离场所选项左侧按钮部分 -->
        <el-row>
          <el-col
            :span="16"
            class="third-row"
          >
            <el-upload
              class="upload-demo"
              action="none"
              accept=".xls,.xlsx"
              :auto-upload="false"
              :limit="1"
              :on-exceed="handleExceed"
              :before-remove="beforeRemove"
              :on-change="checkType3"
            >
              <el-button
                class="btnupload"
                slot="trigger"
                size="small"
                type="primary"
              >隔离场所表格导入</el-button>
              <el-button
                class="btnupload"
                style="margin-left: 10px"
                size="small"
                type="success"
                @click="submitUpload3"
              >上传到服务器
              </el-button>
              <div
                slot="tip"
                class="el-upload__tip"
              >
                只能上传xls/xlsx文件，且不超过2MB
              </div>
            </el-upload>
            <el-link
              type="primary"
              icon="el-icon-download"
              href="../dist/static/model/isolationPlace.xlsx"
            >模板下载</el-link>
          </el-col>
          <el-col
            :span="8"
            class=""
          >
            <el-button
              type="primary"
              @click="
                dialogFormVisible_place = true;
                form2 = {};
              "
            >新增隔离场所</el-button>
          </el-col>
          <!-- 新增隔离场所弹窗 -->
          <el-dialog
            title="新增隔离场所"
            :visible.sync="dialogFormVisible_place"
          >
            <el-form
              :model="form2"
              label-width="auto"
              :rules="rules2"
              ref="form2"
            >
              <el-form-item
                label="场所名称"
                prop="placeName"
              >
                <el-input v-model="form2.placeName"></el-input>
              </el-form-item>
              <el-form-item
                label="场所地址"
                prop="placeAddrDesc"
              >
                <el-input v-model="form2.placeAddrDesc"></el-input>
              </el-form-item>
              <el-form-item
                label="状态"
                prop="inUse"
              >
                <el-select
                  v-model="form2.inUse"
                  placeholder="请选择使用状态"
                >
                  <el-option
                    label="已使用"
                    value="1"
                  ></el-option>
                  <el-option
                    label="未使用"
                    value="2"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="当前隔离人数"
                prop="currentIsolatedNums"
              >
                <el-input v-model="form2.currentIsolatedNums"></el-input>
              </el-form-item>
              <el-form-item
                label="房间总数"
                prop="roomNums"
              >
                <el-input v-model="form2.roomNums"></el-input>
              </el-form-item>
              <el-form-item
                label="已使用房间数"
                prop="roomNumsOfUsed"
              >
                <el-input v-model="form2.roomNumsOfUsed"></el-input>
              </el-form-item>
              <el-form-item
                label="场所责任人名称"
                prop="responsiblerName"
              >
                <el-input v-model="form2.responsiblerName"></el-input>
              </el-form-item>
              <el-form-item
                label="场所责任人电话"
                prop="responsiblerPhone"
              >
                <el-input v-model="form2.responsiblerPhone"></el-input>
              </el-form-item>
              <el-form-item
                label="场所方案"
                prop="placePlan"
              >
                <el-input v-model="form2.placePlan"></el-input>
              </el-form-item>
              <el-form-item
                label="平面图"
                prop="placeImgName"
              >
                <el-upload
                  class="upload-demo"
                  action="#"
                  :auto-upload="false"
                  :show-file-list="false"
                  :on-change="uploadSuccessVoice2"
                >
                  <el-button
                    size="small"
                    type="primary"
                  >点击上传
                  </el-button>
                  <div class="avatar">
                    <div v-if="form2.placeImgName">{{form2.placeImgName}}</div>
                    <img
                      controls="controls"
                      v-if="form2.placeImgName"
                      width="100px"
                      height="100px"
                      :src="form2.placeImgName"
                      alt=""
                    >
                  </div>
                  <div
                    slot="tip"
                    class="el-upload__tip"
                  >只能上传png/jpg文件</div>
                </el-upload>
              </el-form-item>
            </el-form>
            <div
              slot="footer"
              class="dialog-footer"
            >
              <el-button
                type="primary"
                @click="addPlaces('form2')"
              >确 定</el-button>
              <el-button @click="dialogFormVisible_place = false">取 消</el-button>
            </div>
          </el-dialog>
        </el-row>
        <!-- 隔离场所选项分割线部分 -->
        <hr style="background-color: #cccccc; height: 1px; border: 0" />
        <!-- 隔离场所选项表格部分 -->
        <el-row>
          <el-col
            :span="24"
            class="third-row"
          >
            <!-- 隔离场所表单 -->
            <el-table
              v-loading="loading3"
              element-loading-text="加载中"
              element-loading-spinner="el-icon-loading"
              :data="tableData3"
              ref="tableList"
              style="width: 100%; font-size: 14px"
              highlight-current-row
            >
              <el-table-column
                prop="placeName"
                label="场所名称"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="placeAddrDesc"
                label="场所地址"
                align="center"
              >
              </el-table-column>
              <el-table-column
                label="使用状态"
                align="center"
              >
                <template slot-scope="{ row }">
                  {{ useType[row.inUse] }}
                </template>
              </el-table-column>
              <el-table-column
                prop="currentIsolatedNums"
                label="当前隔离人数"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="roomNums"
                label="房间总数"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="roomNumsOfUsed"
                label="已使用房间数"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="responsiblerName"
                label="场所责任人名称"
                align="center"
                width="120"
              >
              </el-table-column>
              <el-table-column
                prop="responsiblerPhone"
                label="场所责任人电话"
                align="center"
                width="120"
              >
              </el-table-column>

              <el-table-column
                prop="placePlan"
                label="场所方案"
                align="center"
                show-overflow-tooltip
              >
              </el-table-column>

              <el-table-column
                label="操作"
                align="center"
                width="180"
              >
                <template slot-scope="{ row }">
                  <el-button
                    type="warning"
                    @click="amendPlaces(row)"
                  >修改</el-button>
                  <el-button
                    type="danger"
                    @click="deletePlaces(row.id)"
                  >删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <!-- 修改隔离场所弹窗 -->
            <el-dialog
              title="修改隔离场所"
              :visible.sync="dialogFormVisible_place2"
            >
              <el-form
                :model="form2"
                label-width="auto"
                :rules="rules2"
                ref="form2_amend"
              >
                <el-form-item
                  label="场所名称"
                  prop="placeName"
                >
                  <el-input v-model="form2.placeName"></el-input>
                </el-form-item>
                <el-form-item
                  label="场所地址"
                  prop="placeAddrDesc"
                >
                  <el-input v-model="form2.placeAddrDesc"></el-input>
                </el-form-item>
                <el-form-item
                  label="状态"
                  prop="inUse"
                >
                  <el-select
                    v-model="form2.inUse"
                    placeholder="请选择使用状态"
                  >
                    <el-option
                      label="已使用"
                      value="1"
                    ></el-option>
                    <el-option
                      label="未使用"
                      value="2"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item
                  label="当前隔离人数"
                  prop="currentIsolatedNums"
                >
                  <el-input v-model="form2.currentIsolatedNums"></el-input>
                </el-form-item>
                <el-form-item
                  label="房间总数"
                  prop="roomNums"
                >
                  <el-input v-model="form2.roomNums"></el-input>
                </el-form-item>
                <el-form-item
                  label="已使用房间数"
                  prop="roomNumsOfUsed"
                >
                  <el-input v-model="form2.roomNumsOfUsed"></el-input>
                </el-form-item>
                <el-form-item
                  label="场所责任人名称"
                  prop="responsiblerName"
                >
                  <el-input v-model="form2.responsiblerName"></el-input>
                </el-form-item>
                <el-form-item
                  label="场所责任人电话"
                  prop="responsiblerPhone"
                >
                  <el-input v-model="form2.responsiblerPhone"></el-input>
                </el-form-item>
                <el-form-item
                  label="场所方案"
                  prop="placePlan"
                >
                  <el-input v-model="form2.placePlan"></el-input>
                </el-form-item>
                <el-form-item
                  label="平面图"
                  prop="placeImgName"
                >
                  <el-upload
                    class="upload-demo"
                    action="#"
                    :auto-upload="false"
                    :show-file-list="false"
                    :on-change="uploadSuccessVoice2"
                  >
                    <el-button
                      size="small"
                      type="primary"
                    >点击上传
                    </el-button>
                    <div class="avatar">
                      <div v-if="form2.placeImgName">{{form2.placeImgName}}</div>
                      <img
                        controls="controls"
                        v-if="form2.placeImgName"
                        width="100px"
                        height="100px"
                        :src="form2.placeImgName"
                        alt=""
                      >
                    </div>
                    <div
                      slot="tip"
                      class="el-upload__tip"
                    >只能上传png/jpg文件</div>
                  </el-upload>
                </el-form-item>
              </el-form>
              <div
                slot="footer"
                class="dialog-footer"
              >
                <el-button
                  type="primary"
                  @click="hangdleAmendPlaces('form2_amend')"
                >确 定</el-button>
                <el-button @click="dialogFormVisible_place2 = false">取 消</el-button>
              </div>
            </el-dialog>
            <!-- 分页器 -->
            <div class="pages">
              <el-pagination
                background
                @size-change="handleSizeChange3"
                @current-change="handleCurrentChange3"
                :page-sizes="[10, 20, 50, 100]"
                :current-page="currentPage3"
                :page-size="pageSize3"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total3"
              >
              </el-pagination>
            </div>
          </el-col>
        </el-row>
      </el-tab-pane>
      <!-- 应急队伍成员列表弹窗部分 -->
      <el-dialog
        title="应急队伍成员列表"
        :visible.sync="dialogTableVisible"
      >
        <el-row>
          <!-- 应急队伍成员列表弹窗按钮部分 -->
          <el-col
            :span="16"
            class="third-row"
          >
            <el-upload
              class="upload-demo"
              action="none"
              accept=".xls,.xlsx"
              :auto-upload="false"
              :limit="1"
              :on-exceed="handleExceed"
              :before-remove="beforeRemove"
              :on-change="checkType_item"
            >
              <el-button
                class="btnupload"
                slot="trigger"
                size="small"
                type="primary"
              >应急队伍成员表格导入
              </el-button>
              <el-button
                class="btnupload"
                style="margin-left: 10px"
                size="small"
                type="success"
                @click="submitUpload_item"
              >上传到服务器
              </el-button>
              <div
                slot="tip"
                class="el-upload__tip"
              >
                只能上传xls/xlsx文件，且不超过2MB
              </div>
            </el-upload>
            <el-link
              type="primary"
              icon="el-icon-download"
              href="../dist/static/model/EmergencyTeamMember.xlsx"
            >模板下载</el-link>
          </el-col>
          <el-col
            :span="8"
            class=""
          >
            <el-button
              type="primary"
              @click="
                dialogFormVisible_teamList = true;
                form4 = {};
              "
            >新增应急队伍成员</el-button>
          </el-col>
          <!-- 新增应急队伍成员弹窗 -->
          <el-dialog
            title="新增应急队伍成员"
            :visible.sync="dialogFormVisible_teamList"
            append-to-body
          >
            <el-form
              :model="form4"
              label-width="auto"
              :rules="rules4"
              ref="form4"
            >
              <el-form-item
                label="小队名称"
                prop="teamNickname"
              >
                <el-input v-model="form4.teamNickname"></el-input>
              </el-form-item>
              <el-form-item
                label="队员姓名"
                prop="memberName"
              >
                <el-input v-model="form4.memberName"></el-input>
              </el-form-item>
              <el-form-item
                label="负责区域"
                prop="dutyArea"
              >
                <el-input v-model="form4.dutyArea"></el-input>
              </el-form-item>
              <el-form-item
                label="职务"
                prop="dutyName"
              >
                <el-input v-model="form4.dutyName"></el-input>
              </el-form-item>
              <el-form-item
                label="工作职责"
                prop="dutyDesc"
              >
                <el-input v-model="form4.dutyDesc"></el-input>
              </el-form-item>
              <el-form-item
                label="联系电话"
                prop="memberPhone"
              >
                <el-input v-model="form4.memberPhone"></el-input>
              </el-form-item>
            </el-form>
            <div
              slot="footer"
              class="dialog-footer"
            >
              <el-button
                type="primary"
                @click="addTeamsList('form4')"
              >确 定</el-button>
              <el-button @click="dialogFormVisible_teamList = false">取 消</el-button>
            </div>
          </el-dialog>
        </el-row>
        <el-table
          :data="tableData_item"
          v-loading="loading_item"
          element-loading-text="加载中"
          element-loading-spinner="el-icon-loading"
        >
          <el-table-column
            property="teamNickname"
            label="小队名称"
          ></el-table-column>
          <el-table-column
            property="memberName"
            label="队员姓名"
          ></el-table-column>
          <el-table-column
            property="dutyArea"
            label="负责区域"
          ></el-table-column>
          <el-table-column
            property="dutyName"
            label="职务"
          ></el-table-column>
          <el-table-column
            property="dutyDesc"
            label="工作职责"
          ></el-table-column>
          <el-table-column
            property="memberPhone"
            label="联系电话"
            width="120"
          ></el-table-column>
          <el-table-column
            label="操作"
            align="center"
            width="180"
          >
            <template slot-scope="{ row }">
              <el-button
                type="warning"
                @click="amendTeamsList(row)"
              >修改</el-button>
              <el-button
                type="danger"
                @click="deleteTeamsList(row.id)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页器 -->
        <div class="pages">
          <el-pagination
            background
            @size-change="handleSizeChange_item"
            @current-change="handleCurrentChange_item"
            :page-sizes="[10, 20, 50, 100]"
            :current-page="currentPage_item"
            :page-size="pageSize_item"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total_item"
          >
          </el-pagination>
        </div>
        <!-- 修改应急队伍成员弹窗 -->
        <el-dialog
          title="修改应急队伍成员"
          :visible.sync="dialogFormVisible_teamList2"
          append-to-body
        >
          <el-form
            :model="form4"
            label-width="auto"
            :rules="rules4"
            ref="form4_amend"
          >
            <el-form-item
              label="小队名称"
              prop="teamNickname"
            >
              <el-input v-model="form4.teamNickname"></el-input>
            </el-form-item>
            <el-form-item
              label="队员姓名"
              prop="memberName"
            >
              <el-input v-model="form4.memberName"></el-input>
            </el-form-item>
            <el-form-item
              label="负责区域"
              prop="dutyArea"
            >
              <el-input v-model="form4.dutyArea"></el-input>
            </el-form-item>
            <el-form-item
              label="职务"
              prop="dutyName"
            >
              <el-input v-model="form4.dutyName"></el-input>
            </el-form-item>
            <el-form-item
              label="工作职责"
              prop="dutyDesc"
            >
              <el-input v-model="form4.dutyDesc"></el-input>
            </el-form-item>
            <el-form-item
              label="联系电话"
              prop="memberPhone"
            >
              <el-input v-model="form4.memberPhone"></el-input>
            </el-form-item>
          </el-form>
          <div
            slot="footer"
            class="dialog-footer"
          >
            <el-button
              type="primary"
              @click="hangdleAmendTeamsList('form4_amend')"
            >确 定</el-button>
            <el-button @click="dialogFormVisible_teamList2 = false">取 消</el-button>
          </div>
        </el-dialog>
      </el-dialog>
    </el-tabs>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tupian: true,
      dialogImageUrl: "",
      dialogVisible: false,
      disabled: false,
      currentFile: null, // 应急队伍当前选择文件
      currentFile_item: null, // 应急队伍成员当前选择文件
      currentFile2: null, // 防疫物资当前选择文件
      currentFile3: null, // 隔离场所当前选择文件

      excelData: [], // 存储excel数据

      tableData: [], // 应急队伍列表数据
      tableData_item: [], // 应急队伍列表数据
      tableData2: [], // 防疫物资列表数据
      tableData3: [], // 隔离场所列表数据

      currentPage: 1, // 应急队伍当前页
      pageSize: 100, // 应急队伍每页记录数
      total: 0, // 应急队伍总行数
      currentPage_item: 1, // 应急队伍成员当前页
      pageSize_item: 100, // 应急队伍成员每页记录数
      total_item: 0, // 应急队伍成员总行数
      currentPage2: 1, // 防疫物资当前页
      pageSize2: 100, // 防疫物资每页记录数
      total2: 0, // 防疫物资总行数
      currentPage3: 1, // 隔离场所当前页
      pageSize3: 100, // 隔离场所每页记录数
      total3: 0, // 隔离场所总行数

      loading: true,
      loading_item: true,
      loading2: true,
      loading3: true,

      dialogTableVisible: false, // 应急队伍成员列表弹窗控制
      dialogFormVisible_teamList: false, // 新增应急队伍成员弹窗控制
      dialogFormVisible_teamList2: false, // 修改应急队伍成员弹窗控制

      dialogFormVisible_good: false, // 新增防疫物资弹窗控制
      dialogFormVisible_good2: false, // 修改防疫物资弹窗控制

      dialogFormVisible_place: false, // 新增隔离场所弹窗控制
      dialogFormVisible_place2: false, // 修改隔离场所弹窗控制

      dialogFormVisible_team: false, // 新增应急队伍弹窗控制
      dialogFormVisible_team2: false, // 修改应急队伍弹窗控制
      teamId: 0,
      goodsid: "",
      placesid: "",
      useType: ["", "已使用", "未使用"],
      form: {
        type: "",
        suppliesName: "",
        suppliesNum: "",
        suppliesRequireNum: "",
      },
      form2: {
        placeName: "",
        placeAddrDesc: "",
        inUse: "",
        currentIsolatedNums: "",
        roomNums: "",
        roomNumsOfUsed: "",
        responsiblerName: "",
        responsiblerPhone: "",
        placePlan: "",
        placeImgName: "", //图片url
        extraFileShowName: "", //图片名
      },
      form3: {
        teamName: "",
        teamNum: "",
        teamNumOfPeople: "",
      },
      form4: {
        teamId: "",
        teamNickname: "",
        memberName: "",
        dutyArea: "",
        dutyName: "",
        dutyDesc: "",
        memberPhone: "",
      },
      rules: {
        type: [{ required: true, message: "请输入物资种类", trigger: "blur" }],
        suppliesName: [
          { required: true, message: "请输入物资名称", trigger: "blur" },
        ],
        suppliesNum: [
          { required: true, message: "请输入现有储备（件）", trigger: "blur" },
        ],
        suppliesRequireNum: [
          { required: true, message: "请输入储备要求（件）", trigger: "blur" },
        ],
      },
      rules2: {
        placeName: [
          { required: true, message: "请输入场所名称", trigger: "blur" },
        ],
        placeAddrDesc: [
          { required: true, message: "请输入场所地址", trigger: "blur" },
        ],
        inUse: [
          { required: true, message: "请选择使用状态", trigger: "change" },
        ],
        currentIsolatedNums: [
          { required: true, message: "请输入当前隔离人数", trigger: "blur" },
        ],
        roomNums: [
          { required: true, message: "请输入房间总数", trigger: "blur" },
        ],
        roomNumsOfUsed: [
          { required: true, message: "请输入已使用房间数", trigger: "blur" },
        ],
        responsiblerName: [
          { required: true, message: "请输入场所责任人名称", trigger: "blur" },
        ],
        responsiblerPhone: [
          { required: true, message: "请输入场所责任人电话", trigger: "blur" },
        ],
        placePlan: [
          { required: true, message: "请输入场所方案", trigger: "blur" },
        ],
        placeImgName: [{ required: false, trigger: "change" }],
      },
      rules3: {
        teamName: [
          { required: true, message: "请输入队伍名称", trigger: "blur" },
        ],
        teamNum: [
          { required: true, message: "请输入队伍数量", trigger: "blur" },
        ],
        teamNumOfPeople: [
          { required: true, message: "请选择队伍人数", trigger: "blur" },
        ],
      },
      rules4: {
        teamNickname: [
          { required: true, message: "请输入小队名称", trigger: "blur" },
        ],
        memberName: [
          { required: true, message: "请输入队员姓名", trigger: "blur" },
        ],
        dutyArea: [
          { required: true, message: "请选择负责区域", trigger: "blur" },
        ],
        dutyName: [{ required: true, message: "请输入职务", trigger: "blur" }],
        dutyDesc: [
          { required: true, message: "请输入工作职责", trigger: "blur" },
        ],
        memberPhone: [
          { required: true, message: "请选择联系电话", trigger: "blur" },
        ],
      },
    };
  },
  mounted() {
    this.getTableData();
    this.getTableData2();
    this.getTableData3();
  },
  methods: {
    //上传图片
    async uploadSuccessVoice2(file) {
      const loading = this.$loading({
        lock: true,
        text: "上传中",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      // 上传前限制文件大小
      const isMp3 = file.raw.type === "image/jpg" || "image/png";

      const isLt30M = file.raw.size / 1024 / 1024 < 30;

      if (!isMp3 || !isLt30M) {
        loading.close();
        this.$message.error("上传音频只能是img/jpg格式，且不能超过 30MB!");
      } else {
        let formData = new FormData();
        // console.log(file.raw)
        formData.append("file", file.raw);
        let res = await this.$axios({
          url: "/diseaseRight/file/imageUpload",
          method: "post",
          data: formData,
          headers: {
            "Admin-Token": sessionStorage.getItem("token"),
          },
        });
        // console.log(res.data)
        if (res.data.success) {
          this.$set(this.form2, "placeImgName", res.data.data.imageName);
          // this.$set(this.form2, "extraFileShowName", res.data.data.showUrl);
          this.$message.success("图片上传成功");
        } else {
          this.$message.error("图片上传失败");
        }
        loading.close();
      }
    },
    // 新增应急队伍
    addTeams(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_team = false;
          let res = await this.$axios({
            method: "post",
            url: "/diseaseRight/emergencyTeam/save",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form3,
          });
          // console.log(res);
          if (res.data.success) {
            this.loading = true;
            this.getTableData();
            this.$message.success("添加成功!");
          } else {
            this.$message.error("添加失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 修改应急队伍
    amendTeams(row) {
      this.form3 = { ...row };
      this.teamId = row.id;
      this.dialogFormVisible_team2 = true;
    },
    // 修改应急队伍请求
    hangdleAmendTeams(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_team2 = false;
          let res = await this.$axios({
            method: "put",
            url: "/diseaseRight/emergencyTeam/update",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form3,
          });
          if (res.data.success) {
            this.loading = true;
            this.getTableData();
            this.$message.success("修改成功!");
          } else {
            this.$message.error("修改失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 删除应急队伍
    deleteTeams(id) {
      this.teamId = id;
      this.$confirm("确定删除吗?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning",
      })
        .then(async () => {
          let res = await this.$axios({
            method: "delete",
            url: "/diseaseRight/emergencyTeam/delete",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: [this.teamId],
          });
          // console.log(res);
          if (res.data.success) {
            this.loading = true;
            this.$message.success("删除成功");
            let totalPage = Math.ceil((this.total - 1) / this.pageSize);
            let currentPage =
              this.currentPage > totalPage ? totalPage : this.currentPage;
            this.currentPage = currentPage < 1 ? 1 : currentPage;
            this.getTableData();
          } else {
            this.$message.error("删除失败!");
          }
        })
        .catch(() => {
          this.$message.info("已取消");
        });
    },

    // 新增应急队伍成员
    addTeamsList(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_teamList = false;
          this.form4.teamId = this.teamId;
          // console.log(this.form4);
          let res = await this.$axios({
            method: "post",
            url: "/diseaseRight/emergencyTeam/member/save",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form4,
          });
          if (res.data.success) {
            this.loading_item = true;
            this.getTableData_item();
            this.$message.success("添加成功!");
          } else {
            this.$message.error("添加失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 修改应急队伍成员
    amendTeamsList(row) {
      this.form4 = { ...row };
      // this.teamId = row.id;
      this.dialogFormVisible_teamList2 = true;
    },
    // 修改应急队伍成员请求
    hangdleAmendTeamsList(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_teamList2 = false;
          let res = await this.$axios({
            method: "put",
            url: "/diseaseRight/emergencyTeam/member/update",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form4,
          });
          if (res.data.success) {
            this.loading_item = true;
            this.getTableData_item();
            this.$message.success("修改成功!");
          } else {
            this.$message.error("修改失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 删除应急队伍成员
    deleteTeamsList(id) {
      this.$confirm("确定删除吗?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning",
      })
        .then(async () => {
          let res = await this.$axios({
            method: "delete",
            url: "/diseaseRight/emergencyTeam/member/delete",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: [id],
          });
          if (res.data.success) {
            this.loading_item = true;
            this.$message.success("删除成功");
            let totalPage = Math.ceil(
              (this.total_item - 1) / this.pageSize_item
            );
            let currentPage =
              this.currentPage_item > totalPage
                ? totalPage
                : this.currentPage_item;
            this.currentPage_item = currentPage < 1 ? 1 : currentPage;
            this.getTableData_item();
          } else {
            this.$message.error("删除失败!");
          }
        })
        .catch(() => {
          this.$message.info("已取消");
        });
    },

    // 新增防疫物资
    addGoods(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_good = false;
          let res = await this.$axios({
            method: "post",
            url: "/diseaseRight/emergencySupplies/save",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form,
          });
          if (res.data.success) {
            this.loading2 = true;
            this.getTableData2();
            this.$message.success("添加成功!");
          } else {
            this.$message.error("添加失败!");
          }
        } else {
          console.log("提交失败!!");
          return false;
        }
      });
    },
    // 修改防疫物资
    amendGoods(row) {
      this.form = { ...row };
      this.goodsid = row.id;
      this.dialogFormVisible_good2 = true;
    },
    // 修改防疫物资请求
    hangdleAmendGoods(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_good2 = false;
          let res = await this.$axios({
            method: "put",
            url: "/diseaseRight/emergencySupplies/update",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form,
          });
          if (res.data.success) {
            this.loading2 = true;
            this.getTableData2();
            this.$message.success("修改成功!");
          } else {
            this.$message.error("修改失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 删除防疫物资
    deleteGoods(id) {
      this.goodsid = id;
      this.$confirm("确定删除吗?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning",
      })
        .then(async () => {
          let res = await this.$axios({
            method: "delete",
            url: "/diseaseRight/emergencySupplies/delete",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: [this.goodsid],
          });
          if (res.data.success) {
            this.loading2 = true;
            this.$message.success("删除成功");
            let totalPage = Math.ceil((this.total2 - 1) / this.pageSize2);
            let currentPage =
              this.currentPage2 > totalPage ? totalPage : this.currentPage2;
            this.currentPage2 = currentPage < 1 ? 1 : currentPage;
            this.getTableData2();
          } else {
            this.$message.error("删除失败!");
          }
        })
        .catch(() => {
          this.$message.info("已取消");
        });
    },

    // 新增隔离场所
    addPlaces(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_place = false;
          let res = await this.$axios({
            method: "post",
            url: "/diseaseRight/isolatedPlace/save",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form2,
          });
          console.log(this.form2);
          console.log(res.data);
          if (res.data.success) {
            this.loading3 = true;
            this.getTableData3();
            this.$message.success("添加成功!");
          } else {
            this.$message.error("添加失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 修改隔离场所
    amendPlaces(row) {
      this.form2 = { ...row };
      this.placesid = row.id;
      this.dialogFormVisible_place2 = true;
    },
    // 修改隔离场所请求
    hangdleAmendPlaces(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.dialogFormVisible_place2 = false;
          let res = await this.$axios({
            method: "put",
            url: "/diseaseRight/isolatedPlace/update",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: this.form2,
          });
          // console.log(res.data)
          if (res.data.success) {
            this.loading3 = true;
            this.getTableData3();
            this.$message.success("修改成功!");
          } else {
            this.$message.error("修改失败!");
          }
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 删除隔离场所
    deletePlaces(id) {
      this.placesid = id;
      this.$confirm("确定删除吗?", "提示", {
        cancelButtonText: "取消",
        confirmButtonText: "确定",
        type: "warning",
      })
        .then(async () => {
          let res = await this.$axios({
            method: "delete",
            url: "/diseaseRight/isolatedPlace/delete",
            headers: {
              "Admin-Token": sessionStorage.getItem("token"),
            },
            data: [this.placesid],
          });
          if (res.data.success) {
            this.loading3 = true;
            this.$message.success("删除成功");
            let totalPage = Math.ceil((this.total3 - 1) / this.pageSize3);
            let currentPage =
              this.currentPage3 > totalPage ? totalPage : this.currentPage3;
            this.currentPage3 = currentPage < 1 ? 1 : currentPage;
            this.getTableData3();
          } else {
            this.$message.error("删除失败!");
          }
        })
        .catch(() => {
          this.$message.info("已取消");
        });
    },

    // 查看详情回调
    showPop(i) {
      this.dialogTableVisible = true;
      this.teamId = i;
      console.log(this.teamId);
      this.getTableData_item();
    },
    //   获取应急队伍列表数据
    async getTableData() {
      let res = await this.$axios.get("/diseaseRight/emergencyTeam/list", {
        params: {
          curPage: this.currentPage,
          pageSize: this.pageSize,
        },
      });
      if (res.data.success) {
        this.tableData = res.data.data.list;
        this.total = res.data.data.totalCount;
        this.loading = false;
      } else {
        console.log("请求错误");
      }
    },
    //   获取应急队伍成员列表数据
    async getTableData_item() {
      let res = await this.$axios.get(
        `/diseaseRight/emergencyTeam/list/member/${this.teamId}/v2`,
        {
          params: {
            curPage: this.currentPage_item,
            pageSize: this.pageSize_item,
          },
        }
      );
      if (res.data.success) {
        this.tableData_item = res.data.data.page.list;
        this.total_item = res.data.data.page.totalCount;
        this.loading_item = false;
      } else {
        console.log("请求错误");
      }
    },
    //   获取防疫物资列表数据
    async getTableData2() {
      let res = await this.$axios.get("/diseaseRight/emergencySupplies/list", {
        params: {
          curPage: this.currentPage2,
          pageSize: this.pageSize2,
        },
      });
      if (res.data.success) {
        this.tableData2 = res.data.data.list;
        this.total2 = res.data.data.totalCount;
        this.loading2 = false;
      } else {
        console.log("请求错误");
      }
    },
    //   获取隔离场所列表数据
    async getTableData3() {
      let res = await this.$axios.get("/diseaseRight/isolatedPlace/list", {
        params: {
          curPage: this.currentPage3,
          pageSize: this.pageSize3,
        },
      });
      if (res.data.success) {
        this.tableData3 = res.data.data.list;
        this.total3 = res.data.data.totalCount;
        this.loading3 = false;
      } else {
        console.log("请求错误");
      }
    },
    // 应急队伍翻页方法
    handleSizeChange(val) {
      this.pageSize = val;
      this.loading = true;
      this.getTableData();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.loading = true;
      this.getTableData();
    },
    // 应急队伍成员翻页方法
    handleSizeChange_item(val) {
      this.pageSize_item = val;
      this.loading_item = true;
      this.getTableData_item();
    },
    handleCurrentChange_item(val) {
      this.currentPage_item = val;
      this.loading_item = true;
      this.getTableData_item();
    },
    // 防疫物资翻页方法
    handleSizeChange2(val) {
      this.loading2 = true;
      this.pageSize2 = val;
      this.getTableData2();
    },
    handleCurrentChange2(val) {
      this.loading2 = true;
      this.currentPage2 = val;
      this.getTableData2();
    },
    // 隔离场所翻页方法
    handleSizeChange3(val) {
      this.loading3 = true;
      this.pageSize3 = val;
      this.getTableData3();
    },
    handleCurrentChange3(val) {
      this.loading3 = true;
      this.currentPage3 = val;
      this.getTableData3();
    },
    // 检查文件类型大小
    checkType(file, fileList) {
      console.log(fileList);
      let fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
      fileList = [];
      if (fileType !== "xls" && fileType !== "xlsx") {
        this.$message.error("文件格式不正确");
        return false;
      }
      if (file.size / 1024 / 1024 > 2) {
        this.$message.error("文件大小不能超过2M");
        return false;
      }
      this.currentFile = file;
    },
    checkType_item(file, fileList) {
      console.log(fileList);
      let fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
      fileList = [];
      if (fileType !== "xls" && fileType !== "xlsx") {
        this.$message.error("文件格式不正确");
        return false;
      }
      if (file.size / 1024 / 1024 > 2) {
        this.$message.error("文件大小不能超过2M");
        return false;
      }
      this.currentFile_item = file;
    },
    checkType2(file, fileList) {
      console.log(fileList);
      let fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
      fileList = [];
      if (fileType !== "xls" && fileType !== "xlsx") {
        this.$message.error("文件格式不正确");
        return false;
      }
      if (file.size / 1024 / 1024 > 2) {
        this.$message.error("文件大小不能超过2M");
        return false;
      }
      this.currentFile2 = file;
    },
    checkType3(file, fileList) {
      console.log(fileList);
      let fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
      fileList = [];
      if (fileType !== "xls" && fileType !== "xlsx") {
        this.$message.error("文件格式不正确");
        return false;
      }
      if (file.size / 1024 / 1024 > 2) {
        this.$message.error("文件大小不能超过2M");
        return false;
      }
      this.currentFile3 = file;
    },
    // 上传文件
    async submitUpload() {
      if (this.currentFile) {
        let formData = new FormData();
        formData.append("file", this.currentFile.raw);
        let res = await this.$axios({
          method: "post",
          url: "/diseaseRight/emergencyTeam/saveByExcel",
          headers: {
            "Admin-Token": sessionStorage.getItem("token"),
          },
          data: formData,
        });
        // console.log(res);
        if (res.data.success) {
          this.loading = true;
          this.$message.success("文件上传成功!");
          this.getTableData();
        } else {
          this.$message.error("文件上传失败,上传的是否是模板文件!");
          console.log(res.data.message);
        }
      } else {
        this.$message.error("请先导入文件");
        return false;
      }
    },
    async submitUpload_item() {
      if (this.currentFile_item) {
        let formData = new FormData();
        formData.append("file", this.currentFile_item.raw);
        let res = await this.$axios({
          method: "post",
          url: `/diseaseRight/emergencyTeam/member/${this.teamId}/saveByExcel`,
          headers: {
            "Admin-Token": sessionStorage.getItem("token"),
          },
          data: formData,
        });
        if (res.data.success) {
          this.loading_item = true;
          this.$message.success("文件上传成功!");
          this.getTableData_item();
        } else {
          this.$message.error("文件上传失败,上传的是否是模板文件!");
          console.log(res.data.message);
        }
      } else {
        this.$message.error("请先导入文件");
        return false;
      }
    },
    async submitUpload2() {
      if (this.currentFile2) {
        let formData = new FormData();
        formData.append("file", this.currentFile2.raw);
        let res = await this.$axios({
          method: "post",
          url: "/diseaseRight/emergencySupplies/saveByExcel",
          headers: {
            "Admin-Token": sessionStorage.getItem("token"),
          },
          data: formData,
        });
        if (res.data.success) {
          this.loading2 = true;
          this.$message.success("文件上传成功!");
          this.getTableData2();
        } else {
          this.$message.error("文件上传失败,上传的是否是模板文件!");
          console.log(res.data.message);
        }
      } else {
        this.$message.error("请先导入文件");
        return false;
      }
    },
    async submitUpload3() {
      if (this.currentFile3) {
        let formData = new FormData();
        formData.append("file", this.currentFile3.raw);
        let res = await this.$axios({
          method: "post",
          url: "/diseaseRight/isolatedPlace/saveByExcel",
          headers: {
            "Admin-Token": sessionStorage.getItem("token"),
          },
          data: formData,
        });
        if (res.data.success) {
          this.loading3 = true;
          this.$message.success("文件上传成功!");
          this.getTableData3();
        } else {
          this.$message.error("文件上传失败,上传的是否是模板文件!");
          console.log(res.data.message);
        }
      } else {
        this.$message.error("请先导入文件");
        return false;
      }
    },
    // 文件列表移除文件时的钩子
    beforeRemove(file) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    // 文件超出个数限制时的钩子
    handleExceed(files, fileList) {
      this.$message.warning("只能同时上传一个文件");
    },
  },
};
</script>

<style scoped>
@import url("yingjichubei.css");
</style>
