Просмотр исходного кода

增加组织架构管理->人员管理 导入功能, 添加upload组件对.xlsx的校验

wangguangping 3 лет назад
Родитель
Сommit
d13d93b470
2 измененных файлов с 26 добавлено и 0 удалено
  1. 7 0
      src/components/upload.vue
  2. 19 0
      src/pages/main/organizaStructure/staffManage.vue

+ 7 - 0
src/components/upload.vue

@@ -71,6 +71,13 @@
                         return false
                     }
                 }
+                if(this.fileInfo.typexz == 'xlsx'){
+                    const isImg = file.name.split(".")[1] == 'xlsx';
+                    if (!isImg) {
+                        this.$message.error('请上传xlsx格式文件!');
+                        return false
+                    }
+                }
                 this.loading = true;
                 let query = new FormData();
                 query.append("file", file);

+ 19 - 0
src/pages/main/organizaStructure/staffManage.vue

@@ -5,6 +5,9 @@
             <div class="search">
                 <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
                 <span>
+                    <!-- <el-button type="primary" @click="dialogCheck(4)" size="medium">导入</el-button> -->
+                    <myUpload style="display:inline-block;" :fileInfo="fileInfo"
+                        :fileList="fileInfo.fileList" @uploadBack='uploadBack'></myUpload>
                     <el-button type="primary" @click="dialogCheck(3)" size="medium">添加</el-button>
                     <!-- <el-button type="primary" @click="dialogCheck(3)" size="medium">导入</el-button> -->
                     <!-- <el-button type="primary" @click="dialogCheck(3)" size="medium">导出</el-button> -->
@@ -225,6 +228,17 @@
                 uplevelopt:[],
                 kindopt:[],
                 typeopt:[],
+
+                // 导入
+                fileInfo: {
+                    type: 'btn',
+                    typename: '导入',
+                    btntype: 'primary',
+                    // limit: 1,
+                    url: '/market/cMkOrgUser/orgUserImportNew',
+                    fileList: [],
+                    typexz:"xlsx"
+                },
             }
         },
         methods: {
@@ -267,6 +281,7 @@
                 this.pageSize = v;
                 this.getList(this.params, this.pageSize);
             },
+            
             //申请
             dialogCheck(v, n) {
                 this.dialogStatus = true;
@@ -364,6 +379,10 @@
                     }
                 })
             },
+            // 导入
+            uploadBack(v) {
+                console.log(v);
+            },
             closeMessage(v) {
                 this.centerDialogVisible = false;
                 let _this = this;