|  | @@ -37,6 +37,8 @@
 | 
	
		
			
				|  |  |            <el-row>
 | 
	
		
			
				|  |  |              <el-button v-if="hasPermission('reimbursementUser:add')" type="primary" icon="el-icon-plus" size="small" @click="add()">新增</el-button>
 | 
	
		
			
				|  |  |              <el-button v-if="hasPermission('reimbursementUser:del')" type="danger"   size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.reimbursementUserTable && $refs.reimbursementUserTable.getCheckboxRecords().length === 0" plain>删除</el-button>
 | 
	
		
			
				|  |  | +            <el-button v-if="hasPermission('reimbursementUser:import')"  type="default" @click="downloadTpl()" size="small">下载模板</el-button>
 | 
	
		
			
				|  |  | +            <el-button v-if="hasPermission('reimbursementUser:add')" type="success" icon="el-icon-success" size="small" @click="initialize()">初始化</el-button>
 | 
	
		
			
				|  |  |            </el-row>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  |        </vxe-toolbar>
 | 
	
	
		
			
				|  | @@ -54,6 +56,10 @@
 | 
	
		
			
				|  |  |            highlight-hover-row
 | 
	
		
			
				|  |  |            :menu-config="{}"
 | 
	
		
			
				|  |  |            :print-config="{}"
 | 
	
		
			
				|  |  | +          :import-config="{
 | 
	
		
			
				|  |  | +                    importMethod: importMethod,
 | 
	
		
			
				|  |  | +                    types: ['xls', 'xlsx'],
 | 
	
		
			
				|  |  | +                    remote: true}"
 | 
	
		
			
				|  |  |            :export-config="{}"
 | 
	
		
			
				|  |  |            @sort-change="sortChangeHandle"
 | 
	
		
			
				|  |  |            :sort-config="{remote:true}"
 | 
	
	
		
			
				|  | @@ -169,6 +175,27 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        this.refreshList()
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    // 自定义服务端导入
 | 
	
		
			
				|  |  | +    importMethod ({ file }) {
 | 
	
		
			
				|  |  | +      // 处理表单
 | 
	
		
			
				|  |  | +      const formBody = new FormData()
 | 
	
		
			
				|  |  | +      formBody.append('file', file)
 | 
	
		
			
				|  |  | +      this.reimbursementUser.importExcel(formBody).then(result => {
 | 
	
		
			
				|  |  | +        this.$message.success(result.data)
 | 
	
		
			
				|  |  | +        this.refreshList()
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 下载模板
 | 
	
		
			
				|  |  | +    downloadTpl () {
 | 
	
		
			
				|  |  | +      this.reimbursementUser.exportTemplate().then((res) => {
 | 
	
		
			
				|  |  | +        // 将二进制流文件写入excel表,以下为重要步骤
 | 
	
		
			
				|  |  | +        this.$utils.downloadExcel(res.data, '报销人员导入模板')
 | 
	
		
			
				|  |  | +      }).catch(function (err) {
 | 
	
		
			
				|  |  | +        if (err.response) {
 | 
	
		
			
				|  |  | +          console.log(err.response)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      // 新增
 | 
	
		
			
				|  |  |      add () {
 | 
	
		
			
				|  |  |        this.$refs.reimbursementUserForm.init('add', {id: '', parent: {id: '', name: ''}})
 | 
	
	
		
			
				|  | @@ -203,8 +230,27 @@ export default {
 | 
	
		
			
				|  |  |              type: 'success',
 | 
	
		
			
				|  |  |              duration: 1500
 | 
	
		
			
				|  |  |            })
 | 
	
		
			
				|  |  | +          this.refreshList()
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 初始化按钮
 | 
	
		
			
				|  |  | +    initialize () {
 | 
	
		
			
				|  |  | +      this.$confirm(`确定初始化人员信息吗?`, '提示', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +        type: 'warning'
 | 
	
		
			
				|  |  | +      }).then(() => {
 | 
	
		
			
				|  |  | +        this.loading = true
 | 
	
		
			
				|  |  | +        this.reimbursementUser.initialize().then(({data}) => {
 | 
	
		
			
				|  |  | +          this.loading = false
 | 
	
		
			
				|  |  | +          this.$message({
 | 
	
		
			
				|  |  | +            message: data,
 | 
	
		
			
				|  |  | +            type: 'success',
 | 
	
		
			
				|  |  | +            duration: 1500
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          this.refreshList()
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  | -        this.refreshList()
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 |