Kaynağa Gözat

徐明浩
定点测厚-导入批量更新

徐明浩 3 yıl önce
ebeveyn
işleme
67393b7ca1

+ 3 - 0
master/src/main/java/com/ruoyi/project/common/CommonController.java

@@ -274,6 +274,9 @@ public class CommonController extends BaseController
         }else if( type.equals("reportYlgd") ) {
             downloadname = "压力管道年检报告批量导入更新模板.xlsx";
             url = "static/template/sems/reportYlgd.xlsx";
+        }else if( type.equals("thickness") ) {
+            downloadname = "定点测厚批量导入更新模板.xlsx";
+            url = "static/template/sems/thickness.xlsx";
         }
         InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(url);
 

+ 126 - 60
master/src/main/java/com/ruoyi/project/sems/controller/TMeasureRecordController.java

@@ -1,33 +1,32 @@
 package com.ruoyi.project.sems.controller;
 
-import java.math.BigDecimal;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
 import com.alibaba.fastjson.JSON;
-import com.ruoyi.project.sems.domain.TMeasureThickness;
-import com.ruoyi.project.sems.service.ITMeasureThicknessService;
-import org.apache.poi.ss.formula.functions.T;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.sems.domain.TMeasureRecord;
-import com.ruoyi.project.sems.service.ITMeasureRecordService;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.sems.domain.TMeasureRecord;
+import com.ruoyi.project.sems.domain.TMeasureThickness;
+import com.ruoyi.project.sems.service.ITMeasureRecordService;
+import com.ruoyi.project.sems.service.ITMeasureThicknessService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 /**
  * 测厚记录Controller
@@ -37,18 +36,17 @@ import com.ruoyi.framework.web.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/sems/measure-record")
-public class TMeasureRecordController extends BaseController
-{
+public class TMeasureRecordController extends BaseController {
     @Autowired
     private ITMeasureRecordService tMeasureRecordService;
     @Autowired
     private ITMeasureThicknessService tMeasureThicknessService;
+
     /**
      * 查询测厚记录列表
      */
     @GetMapping("/list")
-    public TableDataInfo list(TMeasureRecord tMeasureRecord)
-    {
+    public TableDataInfo list(TMeasureRecord tMeasureRecord) {
         startPage();
         List<TMeasureRecord> list = tMeasureRecordService.selectTMeasureRecordList(tMeasureRecord);
         return getDataTable(list);
@@ -59,8 +57,7 @@ public class TMeasureRecordController extends BaseController
      */
     @Log(title = "测厚记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TMeasureRecord tMeasureRecord)
-    {
+    public AjaxResult export(TMeasureRecord tMeasureRecord) {
         List<TMeasureRecord> list = tMeasureRecordService.selectTMeasureRecordList(tMeasureRecord);
         ExcelUtil<TMeasureRecord> util = new ExcelUtil<TMeasureRecord>(TMeasureRecord.class);
         return util.exportExcel(list, "measure-record");
@@ -70,8 +67,7 @@ public class TMeasureRecordController extends BaseController
      * 获取测厚记录详细信息
      */
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tMeasureRecordService.selectTMeasureRecordById(id));
     }
 
@@ -80,13 +76,12 @@ public class TMeasureRecordController extends BaseController
      */
     @Log(title = "测厚记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TMeasureRecord tMeasureRecord)
-    {
+    public AjaxResult add(@RequestBody TMeasureRecord tMeasureRecord) {
         tMeasureRecordService.insertTMeasureRecord(tMeasureRecord);
         String measureId = tMeasureRecord.getMeasureId();
         try {
             updateMeasure(measureId);
-        }catch (Exception e) {
+        } catch (Exception e) {
             logger.error(JSON.toJSONString(e));
         }
         return toAjax(1);
@@ -97,11 +92,10 @@ public class TMeasureRecordController extends BaseController
      */
     @Log(title = "测厚记录", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TMeasureRecord tMeasureRecord)
-    {
+    public AjaxResult edit(@RequestBody TMeasureRecord tMeasureRecord) {
         tMeasureRecordService.updateTMeasureRecord(tMeasureRecord);
         String measureId = tMeasureRecord.getMeasureId();
-            updateMeasure(measureId);
+        updateMeasure(measureId);
         return toAjax(1);
     }
 
@@ -109,15 +103,14 @@ public class TMeasureRecordController extends BaseController
      * 删除测厚记录
      */
     @Log(title = "测厚记录", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         int res = tMeasureRecordService.deleteTMeasureRecordByIds(ids);
         return toAjax(res);
     }
 
-    public void updateMeasure(String id){
-       TMeasureThickness thickness = tMeasureThicknessService.selectTMeasureThicknessById(Long.parseLong(id));
+    public void updateMeasure(String id) {
+        TMeasureThickness thickness = tMeasureThicknessService.selectTMeasureThicknessById(Long.parseLong(id));
         TMeasureRecord t = new TMeasureRecord();
         t.setMeasureId(id);
         List<TMeasureRecord> list = tMeasureRecordService.selectTMeasureRecordList(t);
@@ -127,40 +120,40 @@ public class TMeasureRecordController extends BaseController
                 //短期速率
                 TMeasureRecord r1 = list.get(0);
                 TMeasureRecord r2 = list.get(1);
-                BigDecimal i =new BigDecimal(r2.getMeasureValue()).setScale(4,BigDecimal.ROUND_HALF_DOWN).subtract(new BigDecimal(r1.getMeasureValue()).setScale(4,BigDecimal.ROUND_HALF_DOWN));
-                int day = formatDate(r1.getMeasureDate(),r2.getMeasureDate());
+                BigDecimal i = new BigDecimal(r2.getMeasureValue()).setScale(4, BigDecimal.ROUND_HALF_DOWN).subtract(new BigDecimal(r1.getMeasureValue()).setScale(4, BigDecimal.ROUND_HALF_DOWN));
+                int day = formatDate(r1.getMeasureDate(), r2.getMeasureDate());
                 logger.info(i + "----" + day);
-                BigDecimal di = new BigDecimal(day).divide(new BigDecimal(365),4,BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal di = new BigDecimal(day).divide(new BigDecimal(365), 4, BigDecimal.ROUND_HALF_DOWN);
                 logger.info(di + "----");
-                BigDecimal st = i.divide(di,3,BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal st = i.divide(di, 3, BigDecimal.ROUND_HALF_DOWN);
                 logger.info(st + "----");
                 thickness.setStCorrosion(String.valueOf(st));
                 //长期速率
-                TMeasureRecord r3 = list.get(list.size()-1);
-                BigDecimal i1 = new BigDecimal(r3.getMeasureValue()).setScale(4,BigDecimal.ROUND_HALF_DOWN).subtract(new BigDecimal(r1.getMeasureValue()).setScale(4,BigDecimal.ROUND_HALF_DOWN));
-                int day1 = formatDate(r1.getMeasureDate(),r3.getMeasureDate());
+                TMeasureRecord r3 = list.get(list.size() - 1);
+                BigDecimal i1 = new BigDecimal(r3.getMeasureValue()).setScale(4, BigDecimal.ROUND_HALF_DOWN).subtract(new BigDecimal(r1.getMeasureValue()).setScale(4, BigDecimal.ROUND_HALF_DOWN));
+                int day1 = formatDate(r1.getMeasureDate(), r3.getMeasureDate());
                 logger.info(i1 + "----" + day1);
-                BigDecimal di2 = new BigDecimal(day1).divide(new BigDecimal(365),4,BigDecimal.ROUND_HALF_DOWN);
-                BigDecimal lt = i1.divide(di2,3,BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal di2 = new BigDecimal(day1).divide(new BigDecimal(365), 4, BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal lt = i1.divide(di2, 3, BigDecimal.ROUND_HALF_DOWN);
                 logger.info(lt + "----");
                 thickness.setLtCorrosion(String.valueOf(lt));
                 //预估寿命
                 BigDecimal e;
-                if (lt.compareTo(st) > 0){
-                    e =lt;
-                }else {
+                if (lt.compareTo(st) > 0) {
+                    e = lt;
+                } else {
                     e = st;
-                };
-                BigDecimal cc =  new BigDecimal(r1.getMeasureValue()).subtract(new BigDecimal(thickness.getThicknessMin()));
+                }
+                BigDecimal cc = new BigDecimal(r1.getMeasureValue()).subtract(new BigDecimal(thickness.getThicknessMin()));
                 logger.info(cc + "----");
-                BigDecimal est = cc.divide(e,2,BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal est = cc.divide(e, 2, BigDecimal.ROUND_HALF_DOWN);
                 thickness.setEstRemain(String.valueOf(est));
             }
         }
         tMeasureThicknessService.updateTMeasureThickness(thickness);
     }
 
-       private int formatDate(Date nowDate, Date sqlDate){
+    private int formatDate(Date nowDate, Date sqlDate) {
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String newDate = df.format(nowDate);
         String sqlDate1 = df.format(sqlDate);
@@ -170,9 +163,82 @@ public class TMeasureRecordController extends BaseController
         } catch (Exception e) {
             e.printStackTrace();
         }
-        Long time =  nowDate.getTime();
-        Long time2 =  sqlDate.getTime();
-        int day = (int) ((time - time2) / (24*3600*1000));
+        Long time = nowDate.getTime();
+        Long time2 = sqlDate.getTime();
+        int day = (int) ((time - time2) / (24 * 3600 * 1000));
         return day;
     }
+
+    /**
+     * 批量导入
+     */
+    @Log(title = "定点测厚批量导入更新", businessType = BusinessType.INSERT)
+    @PostMapping("/importForUpdate")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TMeasureRecord> list = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        int rowNum = sheet.getPhysicalNumberOfRows();
+        int failNumber = 0;
+        for (int i = 1; i < rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                int cellNum = row.getPhysicalNumberOfCells();
+                TMeasureRecord entity = new TMeasureRecord();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setMeasureId(cellValue);
+                    } else if (j == 1) {
+                        entity.setMeasureValue(Double.parseDouble(cellValue));
+                    } else if (j == 2) {
+                        entity.setMeasureDate(sdf.parse(cellValue));
+                    }
+                }
+                entity.setCreaterCode(userId);
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + JSON.toJSONString(e));
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TMeasureRecord t : list
+        ) {
+            failNum++;
+            try {
+                //保存测厚记录
+                String measureId = t.getMeasureId();
+                Long id = this.tMeasureThicknessService.selectByTagNo(measureId);
+                t.setMeasureId(id + "");
+                this.tMeasureRecordService.insertTMeasureRecord(t);
+                this.updateMeasure(id + "");
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + e);
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:" + String.valueOf(successNumber));
+        logger.info("failNumber:" + String.valueOf(failNumber));
+        logger.info("failRow:" + String.valueOf(failRow));
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 16 - 8
master/src/main/java/com/ruoyi/project/sems/mapper/TMeasureThicknessMapper.java

@@ -7,23 +7,31 @@ import com.ruoyi.project.sems.domain.TMeasureThickness;
 
 /**
  * 定点测厚Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2021-07-07
  */
-public interface TMeasureThicknessMapper 
+public interface TMeasureThicknessMapper
 {
     /**
      * 查询定点测厚
-     * 
+     *
      * @param id 定点测厚ID
      * @return 定点测厚
      */
     public TMeasureThickness selectTMeasureThicknessById(Long id);
 
+    /**
+     * 根据位号查询id
+     *
+     * @param tagNo 位号
+     * @return
+     */
+    public Long selectByTagNo(String tagNo);
+
     /**
      * 查询定点测厚列表
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 定点测厚集合
      */
@@ -32,7 +40,7 @@ public interface TMeasureThicknessMapper
 
     /**
      * 新增定点测厚
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 结果
      */
@@ -40,7 +48,7 @@ public interface TMeasureThicknessMapper
 
     /**
      * 修改定点测厚
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 结果
      */
@@ -48,7 +56,7 @@ public interface TMeasureThicknessMapper
 
     /**
      * 删除定点测厚
-     * 
+     *
      * @param id 定点测厚ID
      * @return 结果
      */
@@ -56,7 +64,7 @@ public interface TMeasureThicknessMapper
 
     /**
      * 批量删除定点测厚
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */

+ 17 - 9
master/src/main/java/com/ruoyi/project/sems/service/ITMeasureThicknessService.java

@@ -1,27 +1,35 @@
 package com.ruoyi.project.sems.service;
 
 import java.util.List;
+
 import com.ruoyi.project.sems.domain.TMeasureThickness;
 
 /**
  * 定点测厚Service接口
- * 
+ *
  * @author ruoyi
  * @date 2021-07-07
  */
-public interface ITMeasureThicknessService 
-{
+public interface ITMeasureThicknessService {
     /**
      * 查询定点测厚
-     * 
+     *
      * @param id 定点测厚ID
      * @return 定点测厚
      */
     public TMeasureThickness selectTMeasureThicknessById(Long id);
 
+    /**
+     * 根据位号查询id
+     *
+     * @param tagNo 位号
+     * @return
+     */
+    public Long selectByTagNo(String tagNo);
+
     /**
      * 查询定点测厚列表
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 定点测厚集合
      */
@@ -29,7 +37,7 @@ public interface ITMeasureThicknessService
 
     /**
      * 新增定点测厚
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 结果
      */
@@ -37,7 +45,7 @@ public interface ITMeasureThicknessService
 
     /**
      * 修改定点测厚
-     * 
+     *
      * @param tMeasureThickness 定点测厚
      * @return 结果
      */
@@ -45,7 +53,7 @@ public interface ITMeasureThicknessService
 
     /**
      * 批量删除定点测厚
-     * 
+     *
      * @param ids 需要删除的定点测厚ID
      * @return 结果
      */
@@ -53,7 +61,7 @@ public interface ITMeasureThicknessService
 
     /**
      * 删除定点测厚信息
-     * 
+     *
      * @param id 定点测厚ID
      * @return 结果
      */

+ 5 - 0
master/src/main/java/com/ruoyi/project/sems/service/impl/TMeasureThicknessServiceImpl.java

@@ -31,6 +31,11 @@ public class TMeasureThicknessServiceImpl implements ITMeasureThicknessService
         return tMeasureThicknessMapper.selectTMeasureThicknessById(id);
     }
 
+    @Override
+    public Long selectByTagNo(String tagNo) {
+        return this.tMeasureThicknessMapper.selectByTagNo(tagNo);
+    }
+
     /**
      * 查询定点测厚列表
      *

+ 10 - 6
master/src/main/resources/mybatis/sems/TMeasureThicknessMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.project.sems.mapper.TMeasureThicknessMapper">
-    
+
     <resultMap type="TMeasureThickness" id="TMeasureThicknessResult">
         <result property="id"    column="id"    />
         <result property="plantCode"    column="plant_code"    />
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectTMeasureThicknessList" parameterType="TMeasureThickness" resultMap="TMeasureThicknessResult">
         <include refid="selectTMeasureThicknessVo"/>
-        <where>  
+        <where>
             <if test="plantCode != null  and plantCode != ''"> and plant_code = #{plantCode}</if>
             <if test="unitCode != null  and unitCode != ''"> and unit_code = #{unitCode}</if>
             <if test="tagno != null  and tagno != ''"> and tagno = #{tagno}</if>
@@ -99,12 +99,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <!-- 数据范围过滤 -->
         ${params.dataScopePlant}
     </select>
-    
+
     <select id="selectTMeasureThicknessById" parameterType="Long" resultMap="TMeasureThicknessResult">
         <include refid="selectTMeasureThicknessVo"/>
         where id = #{id}
     </select>
-        
+
+    <select id="selectByTagNo" parameterType="String" resultType="Long">
+        select id from t_measure_thickness where tagno = #{tagno}
+    </select>
+
     <insert id="insertTMeasureThickness" parameterType="TMeasureThickness">
         <selectKey keyProperty="id" resultType="long" order="BEFORE">
             SELECT seq_t_measure_thickness.NEXTVAL as id FROM DUAL
@@ -261,5 +265,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </update>
-    
-</mapper>
+
+</mapper>

BIN
master/src/main/resources/static/template/sems/thickness.xlsx


+ 59 - 7
ui/src/views/sems/thickness/index.vue

@@ -191,6 +191,16 @@
           v-hasPermi="['sems:thickness:export']"
         >{{ $t('导出') }}</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['sems:thickness:edit']"
+        >导入更新数据
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -788,8 +798,39 @@
       <el-button @click="visible = false">{{ $t('取消') }}</el-button>
     </span>
     </el-dialog>
-
-      <record v-if="recordVisible" ref="record" @refreshDataList="getList" :showFlag="showFlag" @closeChildDialog="closeChildDialog"></record>
+    <!-- 用户导入对话框 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :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">
+          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+      <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+        <input name="type" :value="upload.type" hidden/>
+      </form>
+    </el-dialog>
+    <record v-if="recordVisible" ref="record" @refreshDataList="getList" :showFlag="showFlag" @closeChildDialog="closeChildDialog"></record>
   </div>
 </template>
 
@@ -842,6 +883,10 @@ export default {
       plantOptions: [],
         // 用户导入参数
         upload: {
+            //模板下载路由
+            downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+            //模板下载区分
+            type: "thickness",
             // 是否显示弹出层(用户导入)
             open: false,
             // 弹出层标题(用户导入)
@@ -853,7 +898,7 @@ export default {
             // 设置上传的请求头部
             headers: { Authorization: "Bearer " + getToken() },
             // 上传的地址
-            url: process.env.VUE_APP_BASE_API + "/sems/thickness/importData"
+            url: process.env.VUE_APP_BASE_API + "/sems/measure-record/importForUpdate"
         },
       downloadForm: {
         id: '',
@@ -1278,9 +1323,7 @@ export default {
       },
       /** 下载模板操作 */
       importTemplate() {
-          importTemplate().then(response => {
-              this.download(response.msg);
-          });
+        this.$refs['downloadFileForm'].submit()
       },
       // 文件上传中处理
       handleFileUploadProgress(event, file, fileList) {
@@ -1291,7 +1334,15 @@ export default {
           this.upload.open = false;
           this.upload.isUploading = false;
           this.$refs.upload.clearFiles();
-          this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+        if (response.data.length > 0) {
+          let failrow = ''
+          for (let i = 0; i < response.data.length; i++) {
+            failrow += response.data[i] + ','
+          }
+          this.$alert(this.$t('导入成功条数:') + response.msg + '<br>' + this.$t('失败行数:') + failrow, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+        } else {
+          this.$alert(this.$t('导入成功条数:') + response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
+        }
           this.getList();
       },
       // 提交上传文件
@@ -1372,6 +1423,7 @@ export default {
        return "color: rgba(255, 26, 26, 0.98) "
       }
     },
+
   }
 };
 </script>