mirror of
https://gitee.com/elegant_wings/dbd-meeting-html.git
synced 2025-06-21 05:39:36 +08:00
Merge branch 'master' of https://gitee.com/elegant_wings/dbd-meeting-html
This commit is contained in:
commit
e1147d96b4
@ -100,6 +100,22 @@ export function getCustomer (parameter) {
|
||||
})
|
||||
}
|
||||
|
||||
export function importData (data) {
|
||||
return axios({
|
||||
url: api.icsCustomerStaff + '/importData',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function exportTemplate () {
|
||||
return axios({
|
||||
url: api.icsCustomerStaff + '/exportTemplate',
|
||||
method: 'post',
|
||||
data: { }
|
||||
})
|
||||
}
|
||||
|
||||
export function getQiXinBasicInfo (parameter) {
|
||||
return axios({
|
||||
url: api.customer + '/getBasicInfo',
|
||||
|
@ -290,6 +290,9 @@
|
||||
<a-button type='primary' @click='$refs.contactModal.add({ customerId: $route.query.customerId })'>
|
||||
新建企业员工
|
||||
</a-button>
|
||||
<a-button style='margin-left: 30px' type='success' @click='importUser'>
|
||||
导入用户
|
||||
</a-button>
|
||||
</div>
|
||||
<a-table :pagination='false' :columns='contactsItemColumns' :dataSource='contactsItemData' rowKey='id'>
|
||||
<template slot='operation' slot-scope='text, record'>
|
||||
@ -312,10 +315,26 @@
|
||||
</a-tabs>
|
||||
</a-form>
|
||||
<customer-contacts-modal ref='contactModal' @ok='handleContactSaved' />
|
||||
<a-modal v-model="visible" title="导入用户" @ok="handleFileOk" >
|
||||
<div style='display: flex'>
|
||||
<a-upload
|
||||
:fileList="fileList"
|
||||
:headers="headers"
|
||||
accept=".xlsx,.xls"
|
||||
@change="customChange"
|
||||
:customRequest="customRequest">
|
||||
<a-button type="primary" >导入用户数据</a-button>
|
||||
</a-upload>
|
||||
<a-button style='margin-left: 40px' type="primary" @click='exportTemplate'>导出用户模板</a-button>
|
||||
</div>
|
||||
|
||||
</a-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
let downloadLoadingInstance;
|
||||
import moment from 'moment'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
@ -325,7 +344,9 @@ import {
|
||||
getQiXinBasicInfo,
|
||||
getStaffList,
|
||||
selectCustomerStaffList,
|
||||
updateStaffByCustomer
|
||||
updateStaffByCustomer,
|
||||
importData,
|
||||
exportTemplate
|
||||
} from '@/api/admin/customer'
|
||||
import {
|
||||
getFloorList,
|
||||
@ -335,7 +356,8 @@ import { getCustomerContractList } from '@/api/admin/customerContract'
|
||||
import CustomerContactsModal from './modules/CustomerContactsModal.vue'
|
||||
import CustomerAttachmentList from './modules/CustomerAttachmentList.vue'
|
||||
import pick from 'lodash.pick'
|
||||
|
||||
import { message } from 'ant-design-vue'
|
||||
import { download } from '@/utils/request'
|
||||
export default {
|
||||
name: 'BaseForm',
|
||||
components: {
|
||||
@ -393,6 +415,10 @@ export default {
|
||||
title: '手机号',
|
||||
dataIndex: 'mobile'
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'gender'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'operation',
|
||||
@ -439,6 +465,8 @@ export default {
|
||||
form: this.$form.createForm(this),
|
||||
floorList: [],
|
||||
roomList: [],
|
||||
file:'',
|
||||
visible:false
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@ -472,6 +500,87 @@ export default {
|
||||
this.floorList = res.data
|
||||
})
|
||||
},
|
||||
exportTemplate(){
|
||||
exportTemplate().then(res =>{
|
||||
console.log(res)
|
||||
this.downloadFile(res)
|
||||
})
|
||||
},
|
||||
downloadFile (data) {
|
||||
let fileName = '客户导入模板'
|
||||
|
||||
let link = document.createElement('a')
|
||||
let blob = new Blob([data], {type: 'application/vnd.ms-excel;charset=utf-8'});
|
||||
console.log(blob)
|
||||
link.style.display = 'none';
|
||||
link.download = fileName+'.xlsx';
|
||||
link.href = URL.createObjectURL(blob);
|
||||
// link.setAttribute('download', fileName+'.xlsx');
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
URL.revokeObjectURL(link.href); // 释放URL 对象
|
||||
document.body.removeChild(link);
|
||||
|
||||
|
||||
|
||||
// console.log(data)
|
||||
// var link = document.createElement('a')
|
||||
// // 文件导出
|
||||
// if (!data) {
|
||||
// return
|
||||
// }
|
||||
// link.style.display = 'none'
|
||||
// link.href = window.URL.createObjectURL(new Blob([data]))
|
||||
// link.setAttribute('download', '用户导入模板.xls')
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
},
|
||||
|
||||
|
||||
customRequest(file){
|
||||
// file 是上传的文件 其内容会在放在下面截图中
|
||||
// 后端需要接受的参数是 formData数据,
|
||||
// uploadFile 我自己的接口
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('file', file.file)
|
||||
console.log(file)
|
||||
importData(formData).then(res => {
|
||||
if (res.code == 0) {
|
||||
// 调用组件内方法, 设置为成功状态
|
||||
file.onSuccess(res, file.file)
|
||||
file.status = 'done'
|
||||
this.visible =false
|
||||
this.$message.success(res.msg)
|
||||
} 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
|
||||
}
|
||||
},
|
||||
customChange(){
|
||||
|
||||
},
|
||||
//导入用户数据
|
||||
importUser(){
|
||||
this.visible = true
|
||||
},
|
||||
handleFileOk(){
|
||||
console.log(this.file)
|
||||
importData({file:this.file}).then(res =>{
|
||||
console.log(res)
|
||||
})
|
||||
},
|
||||
// 获取房间
|
||||
getRoomList(value) {
|
||||
let param = {
|
||||
|
@ -81,7 +81,6 @@
|
||||
<a-input placeholder='紧急联系人' v-decorator="['urgent']" />
|
||||
</a-form-item>
|
||||
|
||||
</a-form-item>
|
||||
<!-- <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="联系电话">-->
|
||||
<!-- <a-input placeholder="联系电话" v-decorator="['phone']"/>-->
|
||||
<!-- </a-form-item>-->
|
||||
@ -92,8 +91,10 @@
|
||||
</a-modal>
|
||||
</template>
|
||||
<script>
|
||||
import { saveCustomerContacts,getStaffList,updateStaff,getStaffListNotId } from '@/api/admin/customer'
|
||||
import { importData,getStaffList,updateStaff,getCustomer,getStaffListNotId } from '@/api/admin/customer'
|
||||
import pick from 'lodash.pick'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
export default {
|
||||
name: 'CustomerContactsModal',
|
||||
props: {
|
||||
@ -112,12 +113,21 @@ export default {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
uploadUrl: process.env.VUE_APP_API_BASE_URL + '/api/dfs/upload',
|
||||
imageUrl: '',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + storage.get(ACCESS_TOKEN)
|
||||
},
|
||||
confirmLoading: false,
|
||||
mdl: {},
|
||||
customerId: undefined,
|
||||
contactId: undefined,
|
||||
form: this.$form.createForm(this),
|
||||
data:[],
|
||||
photoImageUrl: '',
|
||||
photoLoading: false,
|
||||
avatarImageUrl: '',
|
||||
avatarLoading: false
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
@ -126,6 +136,79 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 照片
|
||||
photoBeforeUpload(file) {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||
if (!isJpgOrPng) {
|
||||
this.$message.error('You can only upload JPG file!')
|
||||
}
|
||||
const isLt2M = file.size / 1024 < 5000
|
||||
if (!isLt2M) {
|
||||
this.$message.error('图片必须小于 5M!')
|
||||
}
|
||||
return isJpgOrPng && isLt2M
|
||||
},
|
||||
photoHandleChange(info) {
|
||||
if (info.file.status === 'uploading') {
|
||||
this.photoLoading = true
|
||||
return
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
const { form: { setFieldsValue } } = this
|
||||
const result = info.file.response
|
||||
// 设置值
|
||||
this.$nextTick(() => {
|
||||
setFieldsValue({
|
||||
// 设置相对路径
|
||||
photo: result.fileName
|
||||
})
|
||||
})
|
||||
// Get this url from response in real world.
|
||||
this.getBase64(info.file.originFileObj, imageUrl => {
|
||||
this.photoImageUrl = imageUrl
|
||||
this.photoLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
// 头像
|
||||
avatarBeforeUpload(file) {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||
if (!isJpgOrPng) {
|
||||
this.$message.error('You can only upload JPG file!')
|
||||
}
|
||||
const isLt2M = file.size / 1024 < 5000
|
||||
if (!isLt2M) {
|
||||
this.$message.error('图片必须小于 5M!')
|
||||
}
|
||||
return isJpgOrPng && isLt2M
|
||||
},
|
||||
avatarHandleChange(info) {
|
||||
if (info.file.status === 'uploading') {
|
||||
this.avatarLoading = true
|
||||
return
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
const { form: { setFieldsValue } } = this
|
||||
const result = info.file.response
|
||||
// 设置值
|
||||
this.$nextTick(() => {
|
||||
setFieldsValue({
|
||||
// 设置相对路径
|
||||
avatar: result.fileName
|
||||
})
|
||||
})
|
||||
// Get this url from response in real world.
|
||||
this.getBase64(info.file.originFileObj, imageUrl => {
|
||||
this.avatarImageUrl = imageUrl
|
||||
this.avatarLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
getBase64(img, callback) {
|
||||
const reader = new FileReader()
|
||||
reader.addEventListener('load', () => callback(reader.result))
|
||||
reader.readAsDataURL(img)
|
||||
},
|
||||
handleSearch(value){
|
||||
let param = {
|
||||
mobile:value
|
||||
@ -151,7 +234,7 @@ export default {
|
||||
let param = {
|
||||
icsCustomerId:contactInfo.customerId
|
||||
}
|
||||
getStaffListNotId(param).then(res =>{
|
||||
getCustomer(param).then(res =>{
|
||||
this.data =res.rows
|
||||
})
|
||||
|
||||
@ -159,10 +242,10 @@ export default {
|
||||
edit (record) {
|
||||
this.mdl = Object.assign(record)
|
||||
console.log(this.mdl)
|
||||
// this.mdl = record
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.mdl, 'id', 'customerId', 'name', 'phone', 'remark'))
|
||||
this.form.setFieldsValue(pick(this.mdl, 'id','name','username','mobile','gender',
|
||||
'photo','avatar','cardNo','address','email','degree','urgent', 'customerId', 'remark'))
|
||||
})
|
||||
},
|
||||
handleSubmit (e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user