Jelajahi Sumber

Merge branch '王立生' of sckj/mz-cloud into master

晨曦 2 tahun lalu
induk
melakukan
4ebb5e4a7a

+ 2 - 0
ruoyi-ui/src/components/BizReadxls/index.js

@@ -13,6 +13,8 @@ BizReadxls.install = function (Vue) {
   Vue.prototype.$impxls = (para, success, cancel) => {
     instance.rest()
     instance.title = '请选择电子表格'
+    instance.idwidth = '980'
+    instance.filename=''
     instance.isShow = true
     if (typeof success !== 'undefined') {
       instance.success = success

+ 16 - 8
ruoyi-ui/src/components/BizReadxls/index.vue

@@ -1,15 +1,13 @@
 <template>
   <div  v-show="isShow">
     <div class="myclass" >
-      <div class="flex" >{{title}}        <input type="file" style="margin-left: 300px;width:200px" ref="upload" accept=".xlsx,.xls" ></div>
+      <div class="flex" >{{title}} <font style="margin-left: 100px;" size="4">{{filename}} </font>      <input type="file" style="margin-left: 200px;width:70px" ref="upload" accept=".xlsx,.xls" ></div>
       <div class="myapp">
         <el-table stripe :row-height="20" :data="trainingList.slice((currentPage-1)*pagesize,currentPage*pagesize)"  @selection-change="handleSelectionChange"  :header-cell-style="rowClass" :cell-style="cellClass">
-          <el-table-column v-if="seltype === 'select'" :key="indexMethod" label="选择" width="100px" height="50px" type="selection" align="center"/>
-          <el-table-column label="ID" width="100px" height="50px" type="index" :index="indexMethod" align="center"/>
-          <el-table-column  v-for="(item,key) in headerlist" width="100px" height="50px" :label="item" :key="key" :align="'center'">
+          <el-table-column label="ID" :width="idwidth+'px'" height="50px" type="index" :index="indexMethod" align="center"/>
+          <el-table-column  v-for="(item,key) in headerlist" width="200px" height="50px" :label="item" :key="key" :align="'center'">
             <template slot-scope="scope">
               <span>{{scope.row[key]}}</span>
-
             </template>
           </el-table-column>
         </el-table>
@@ -39,6 +37,14 @@ export default {
       type: Boolean,
       default: false
     },
+    filename: {
+      type: String,
+      default: ''
+    },
+    idwidth: {
+      type: String,
+      default: '980'
+    },
     success: {
       type: Function,
       default: (para) => {
@@ -94,6 +100,7 @@ export default {
       pagesize:10,
       currentPage:1,
       input:"",
+
     };
   },
   methods: {
@@ -175,8 +182,6 @@ export default {
       this.currentPage = currentPage;
     },
     readExcel(e) {
-      //表格导入
-      // 引入工具库 import 也可以,前提是已经npm 下来了。
       var XLSX = require("xlsx");
       const files = e.target.files;
       var vali=/\.(xlsx|xls)$/;
@@ -198,11 +203,14 @@ export default {
           for (let i = 1; i <outdata.length ; i++) {
             this.trainingList.push(outdata[i]);
           }
-          this.totalcount=this.trainingList.length-1;
+          this.totalcount=this.trainingList.length;
+          if (this.totalcount>=0)
+            this.idwidth="100";
           this.$refs.upload.value = ''; // 处理完成 清空表单值
         } catch (e) {
           return false;
         }};
+      this.filename=files[0].name;
       fileReader.readAsBinaryString(files[0]);
     },
   },