This commit is contained in:
liushuai
2019-07-24 09:38:04 +08:00
parent 5b29bf5f1a
commit 78963ec5ae
8 changed files with 156 additions and 8 deletions

View File

@@ -152,8 +152,13 @@
{{ scope.row.家庭住址 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<el-table-column label="操作" fixed="right" align="center" width="300">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-picture"
@click="handlePicture(scope.row)">上传图片</el-button>
<el-button
size="mini"
type="primary"
@@ -385,11 +390,31 @@
@current-change="handleCurrentChangeN"/>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible" title="上传图片" center style="height: 800px" width="30%">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?num='+ PersonId"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPerson()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { moveGroups, getTree, tree, getTablePeople, getTablePeopleForName, addDepartmentName, delList, editList, delPeopleList, fetchEducationData, fetchPostData, addPeople, editPeople, quit, searchLeavingList } from '@/api/BasicData/PersonnelManagement'
import { uploadPerson } from '@/utils/request'
export default {
data() {
return {
@@ -410,6 +435,9 @@ export default {
nodeName: '',
btnLoading: false,
department_DFV: false,
upload: uploadPerson,
dialogFormVisible: false,
PersonId: '',
department_Form: {
DepartmentName: ''
},
@@ -522,6 +550,32 @@ export default {
}
}
},
uploadSuccess(res) { // 上传成功回调
if (res[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible = false
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
handlePicture(row) {
this.dialogFormVisible = true
this.PersonId = row.人员编号
},
submitPerson() {
this.$refs.upload.submit()
},
handleAdd(formName) {
this.department_Title = '新增部门'
this.department_DFV = true