diff --git a/src/api/admin/customer.js b/src/api/admin/customer.js index 3dd850c..9bf965f 100644 --- a/src/api/admin/customer.js +++ b/src/api/admin/customer.js @@ -100,6 +100,15 @@ export function getCustomer (parameter) { }) } +export function importData (data) { + return axios({ + url: api.icsCustomerStaff + '/importData', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + params: data + }) +} + export function getQiXinBasicInfo (parameter) { return axios({ url: api.customer + '/getBasicInfo', diff --git a/src/views/admin/CustomerEdit.vue b/src/views/admin/CustomerEdit.vue index fc310b6..4a7851c 100644 --- a/src/views/admin/CustomerEdit.vue +++ b/src/views/admin/CustomerEdit.vue @@ -290,6 +290,9 @@ 新建企业员工 + + 导入用户 + @@ -325,7 +361,8 @@ import { getQiXinBasicInfo, getStaffList, selectCustomerStaffList, - updateStaffByCustomer + updateStaffByCustomer, + importData } from '@/api/admin/customer' import { getFloorList, @@ -439,6 +476,8 @@ export default { form: this.$form.createForm(this), floorList: [], roomList: [], + file:'', + visible:false } }, filters: { @@ -472,6 +511,43 @@ export default { this.floorList = res.data }) }, + + customRequest(file){ + // file 是上传的文件 其内容会在放在下面截图中 + // 后端需要接受的参数是 formData数据, + // uploadFile 我自己的接口 + console.log(file) + importData({ filePath:file.file.name }).then(res => { + if (res.success) { + // 调用组件内方法, 设置为成功状态 + file.onSuccess(res, file.file) + file.status = 'done' + } else { + file.onError() + file.status = 'error' + } + }) + }, + + handleFileChange(info){ + this.fileList = info.fileList + + if (info.file.status === 'done') { + const result = info.file.response + this.file =info.file.response + this.fileName = result.fileName + } + }, + //导入用户数据 + importUser(){ + this.visible = true + }, + handleFileOk(){ + console.log(this.file) + importData({file:this.file}).then(res =>{ + console.log(res) + }) + }, // 获取房间 getRoomList(value) { let param = { diff --git a/src/views/admin/modules/CustomerContactsModal.vue b/src/views/admin/modules/CustomerContactsModal.vue index d3e056c..f7d6b90 100644 --- a/src/views/admin/modules/CustomerContactsModal.vue +++ b/src/views/admin/modules/CustomerContactsModal.vue @@ -81,7 +81,6 @@ - @@ -92,8 +91,10 @@