Browse Source

批量导入

master
qushutong 6 years ago
parent
commit
86e9ecfa31
  1. 21
      src/views/modules/user/partymembers.vue

21
src/views/modules/user/partymembers.vue

@ -106,6 +106,16 @@
<el-button type="info" <el-button type="info"
@click="exportHandle()">{{ $t('export') }}</el-button> @click="exportHandle()">{{ $t('export') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item>
<el-upload class="upload-demo"
:action="uploadUrl"
:on-preview="handlePreview"
multiple
:limit="1"
:on-exceed="handleExceed">
<el-button type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form> </el-form>
<el-table v-loading="dataListLoading" <el-table v-loading="dataListLoading"
:data="dataList" :data="dataList"
@ -198,6 +208,7 @@
<script> <script>
import mixinViewModule from '@/mixins/view-module' import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './partymembers-add-or-update' import AddOrUpdate from './partymembers-add-or-update'
import Cookies from 'js-cookie'
export default { export default {
mixins: [mixinViewModule], mixins: [mixinViewModule],
data () { data () {
@ -227,7 +238,8 @@ export default {
gridOptions: [], gridOptions: [],
registOptions: [], registOptions: [],
postOptions: [], postOptions: [],
timeRange: [] timeRange: [],
upLoadUrl: ''
} }
}, },
components: { components: {
@ -237,6 +249,7 @@ export default {
this.getStreetList() this.getStreetList()
this.getRegistOptions() this.getRegistOptions()
this.getPostOptions() this.getPostOptions()
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/app-user/partymembers/importExcel?token=${Cookies.get('token')}`
}, },
methods: { methods: {
selectedTime () { selectedTime () {
@ -336,6 +349,12 @@ export default {
}).catch(() => { }).catch(() => {
this.dataListLoading = false this.dataListLoading = false
}) })
},
handleExceed (files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`)
} }
} }
} }

Loading…
Cancel
Save