ruoyi-ui/src/views/collection/index.vue
@@ -151,12 +151,37 @@
            v-hasPermi="['family:note:export']"
          >导出</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['family:note:export']"
          >导入模板下载</el-button>
        </el-col>
        <el-col :span="1.2">
          <el-upload
            action=""
            class="upload-demo"
            :show-file-list="false"
            :http-request="handleEnport"
          >
            <el-button size="mini"   type="primary"
                       plain
                       icon="el-icon-plus" >导入</el-button>
          </el-upload>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>
    </div>
    <el-table v-loading="loading" :data="collectionList" @selection-change="handleSelectionChange" @row-click="handleCheck" :row-class-name="tableRowClassName" style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;">
      <el-table-column type="selection" width="25"  align="center" />
<!--      <el-table-column label="序号" prop="id" sortable width="80" />-->
      <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="60"/>
      <el-table-column label="获得时间" prop="happenTime" sortable width="100" align="center">
        <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '————'}}</template>
      </el-table-column>
@@ -178,10 +203,24 @@
      <el-table-column label="存放位置" prop="location" sortable width="130" align="center">
        <template slot-scope="scope">{{scope.row.location? scope.row.location: '————'}}</template>
      </el-table-column>
      <el-table-column label="电子文件" prop="url" align="center" sortable  width="110" >
      <el-table-column label="电子文件" prop="url" width="80" >
        <template slot-scope="scope">
          <span v-if= "scope.row.url == ','" ><img src="../../assets/images/文件夹-0.png" /></span>
          <span v-else><img src="../../assets/images/文件夹-1.png" /></span>
          <img
            class="el-upload-list__item-thumbnail"
            src="../../assets/images/deviceLis.png"
            alt=""
            style="width: 35px; height: 35px;"
            fit="cover"
            v-if="scope.row.url !== ','"
          >
          <img
            class="el-upload-list__item-thumbnail"
            src="../../assets/images/deviceA.png"
            alt=""
            style="width: 35px; height: 35px;"
            fit="cover"
            v-if="scope.row.url === ','"
          >
        </template>
      </el-table-column>
@@ -208,12 +247,12 @@
            size="mini"
            @command="(command) => handleCommand(command, scope.row)"
            v-hasPermi="['system:role:edit']">
<!--            <el-button-->
<!--              size="mini"-->
<!--              type="text"-->
<!--              icon="el-icon-d-arrow-right"-->
<!--              @click="handleCheck(scope.row)"-->
<!--            >查看详情</el-button>-->
            <el-button
              size="mini"
              type="text"
              icon="el-icon-d-arrow-right"
              @click="handleCheck(scope.row)"
            >查看详情</el-button>
          </el-dropdown>
        </template>
@@ -225,6 +264,7 @@
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      style="background: #FEF7FC;"
      @pagination="getList"
    />
@@ -344,6 +384,8 @@
//导入接口函数
import {listCollection, getCollection, addCollection,updateCollection, delCollection,uploadPic} from "@/api/collection/index";
import {enload} from "@/api/doctor";
import {Message} from "element-ui";
export default {
@@ -674,6 +716,20 @@
      this.download('zfCollection/export', {
        ...this.queryParams
      }, `zfCollection_${new Date().getTime()}.xlsx`)
    },
    /** 导入操作*/
    handleEnport(params){
      var file = params.file;
      var formData = new FormData();
      formData.append('excelImport', file);
      let _this = this
      enload(formData).then(response => {
        _this.getList();
        Message({ message: "导入成功", type: 'warning' })
      }).catch(() => { Message({ message: "导入失败", type: 'error' })});
    }
  }
};