mirror of
https://gitee.com/elegant_wings/dbd-meeting-html.git
synced 2025-06-21 05:39:36 +08:00
修改了企业添加人员设备功能
This commit is contained in:
parent
6b2e85cbe9
commit
37f55d869e
@ -33,6 +33,36 @@ export function selectCustomerStaffList (parameter) {
|
||||
}
|
||||
|
||||
|
||||
//获取企业下用户设备信息
|
||||
export function selectUserDeviceList (data) {
|
||||
return axios({
|
||||
url: api.icsCustomerStaff + '/selectUserDeviceList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function selectEquipmentListById (data) {
|
||||
return axios({
|
||||
url: api.icsCustomerStaff + '/selectEquipmentListById',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 保存用户和设备关联
|
||||
export function saveUserEquipment (parameter) {
|
||||
return axios({
|
||||
url: api.icsCustomerStaff + '/saveUserEquipment',
|
||||
method: 'post',
|
||||
data: parameter,
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function getStaffListNotId (parameter) {
|
||||
return axios({
|
||||
|
@ -110,7 +110,8 @@
|
||||
</a-col>
|
||||
<a-col :span='12'>
|
||||
<a-form-item :labelCol='labelColHalf' :wrapperCol='wrapperColHalf' label='联系人'>
|
||||
<a-input placeholder='联系人' v-decorator="['contacts',{rules: [{ required: true, message: '请输入联系人' }]}]" />
|
||||
<a-input placeholder='联系人'
|
||||
v-decorator="['contacts',{rules: [{ required: true, message: '请输入联系人' }]}]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span='12'>
|
||||
@ -294,11 +295,21 @@
|
||||
导入用户
|
||||
</a-button>
|
||||
</div>
|
||||
<a-table :pagination='false' :columns='contactsItemColumns' :dataSource='contactsItemData' rowKey='id'>
|
||||
<a-table :pagination='false' :columns='contactsItemColumns'
|
||||
:dataSource='contactsItemData'
|
||||
ref='userTable'
|
||||
rowKey='id'>
|
||||
<span slot='gender' slot-scope='text, record'>
|
||||
{{ record.gender === '1' ? '女' : '男' }}
|
||||
</span>
|
||||
<span slot='num' slot-scope='text, record'>
|
||||
<a @click='handleDeviceTable(record)'>{{ record.num }}</a>
|
||||
</span>
|
||||
<template slot='operation' slot-scope='text, record'>
|
||||
<a-button type="link" @click="$refs.contactModal.add(record)">编辑</a-button>
|
||||
<a-divider type="vertical" />
|
||||
<a-button type='link' @click='$refs.contactModal.add(record)'>编辑</a-button>
|
||||
<a-divider type='vertical' />
|
||||
<a-popconfirm @confirm='handleDeleteContact(record)'>
|
||||
|
||||
<template slot='title'>
|
||||
<span>确定删除 {{ record.name }} 吗?</span>
|
||||
</template>
|
||||
@ -315,26 +326,57 @@
|
||||
</a-tabs>
|
||||
</a-form>
|
||||
<customer-contacts-modal ref='contactModal' @ok='handleContactSaved' />
|
||||
<a-modal v-model="visible" title="导入用户" @ok="handleFileOk" >
|
||||
<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>
|
||||
: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>
|
||||
<a-button style='margin-left: 40px' type='primary' @click='exportTemplate'>导出用户模板</a-button>
|
||||
</div>
|
||||
|
||||
</a-modal>
|
||||
<a-modal v-model='visible1' title='设备授权' width='500px' @ok='itemHandleOk()'>
|
||||
<div class='table-page-search-wrapper'>
|
||||
<a-form layout='inline'>
|
||||
<a-row :gutter='48'>
|
||||
<a-col :md='8' :sm='24'>
|
||||
<span class='table-page-search-submitButtons'>
|
||||
<!-- 查询有问题-->
|
||||
<a-button type='primary' @click='$refs.table.refresh(true)'>查询</a-button>
|
||||
<a-button style='margin-left: 8px' @click='() => (deviceQueryParam = {})'>重置</a-button>
|
||||
</span>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<div class='table-operator'>
|
||||
</div>
|
||||
<a-table
|
||||
size='default'
|
||||
ref='itemTable'
|
||||
rowKey='id'
|
||||
:rowSelection='{ selectedRowKeys: selectedDeviceRowKeys, onChange: onDeviceSelectChange }'
|
||||
:columns='deviceColumns'
|
||||
:dataSource='deviceData'
|
||||
>
|
||||
<span slot='floorName' slot-scope='text, record'>
|
||||
{{ record.buildName + record.roomName }}
|
||||
</span>
|
||||
</a-table>
|
||||
</a-modal>
|
||||
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
let downloadLoadingInstance;
|
||||
let downloadLoadingInstance
|
||||
import moment from 'moment'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
@ -346,7 +388,10 @@ import {
|
||||
selectCustomerStaffList,
|
||||
updateStaffByCustomer,
|
||||
importData,
|
||||
exportTemplate
|
||||
exportTemplate,
|
||||
selectUserDeviceList,
|
||||
selectEquipmentListById,
|
||||
saveUserEquipment
|
||||
} from '@/api/admin/customer'
|
||||
import {
|
||||
getFloorList,
|
||||
@ -358,6 +403,7 @@ 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: {
|
||||
@ -415,9 +461,18 @@ export default {
|
||||
title: '手机号',
|
||||
dataIndex: 'mobile'
|
||||
},
|
||||
{
|
||||
title: '授权设备数量',
|
||||
dataIndex: 'num',
|
||||
scopedSlots: { customRender: 'num' }
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
title: '性别',
|
||||
dataIndex: 'gender'
|
||||
dataIndex: 'gender',
|
||||
scopedSlots: { customRender: 'gender' }
|
||||
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -425,6 +480,23 @@ export default {
|
||||
scopedSlots: { customRender: 'operation' }
|
||||
}
|
||||
],
|
||||
deviceColumns:[
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'equipmentName'
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
dataIndex: 'equipmentNum'
|
||||
},
|
||||
{
|
||||
title: '所属地区',
|
||||
dataIndex: 'floorName',
|
||||
scopedSlots: { customRender: 'floorName' }
|
||||
|
||||
},
|
||||
],
|
||||
deviceData:[],
|
||||
labelColHalf: {
|
||||
span: 6
|
||||
},
|
||||
@ -451,6 +523,9 @@ export default {
|
||||
orderShippingData: [],
|
||||
orderReturnsData: [],
|
||||
contactsItemData: [],
|
||||
|
||||
selectedDeviceRowKeys:[],
|
||||
selectedRowKeys:[],
|
||||
customerForm: {},
|
||||
uploadUrl: process.env.VUE_APP_API_BASE_URL + '/api/dfs/upload',
|
||||
headers: {
|
||||
@ -461,12 +536,14 @@ export default {
|
||||
previewImage: '',
|
||||
loading: false,
|
||||
imageUrl: '',
|
||||
userId:'',
|
||||
// form
|
||||
form: this.$form.createForm(this),
|
||||
floorList: [],
|
||||
roomList: [],
|
||||
file: '',
|
||||
visible:false
|
||||
visible: false,
|
||||
visible1:false,
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@ -491,9 +568,51 @@ export default {
|
||||
}
|
||||
this.handleInit()
|
||||
// 获取楼层
|
||||
this.getFloorDataList();
|
||||
this.getFloorDataList()
|
||||
this.selectUserDeviceList()
|
||||
},
|
||||
methods: {
|
||||
//获取设备数量
|
||||
handleDeviceTable(record){
|
||||
this.visible1 = true
|
||||
this.userId =record.id
|
||||
selectEquipmentListById({userId:record.id}).then(res =>{
|
||||
if (res.data){
|
||||
this.selectedDeviceRowKeys = res.data.map(d => d.id)
|
||||
this.selectedRowKeys = res.data
|
||||
}else {
|
||||
this.selectedDeviceRowKeys = []
|
||||
this.selectedRowKeys = []
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
//设备选中事件
|
||||
onDeviceSelectChange(selectedRowKeys,selectedRows){
|
||||
this.selectedDeviceRowKeys = selectedRowKeys
|
||||
this.selectedRowKeys = selectedRows
|
||||
|
||||
},
|
||||
itemHandleOk(){
|
||||
saveUserEquipment(
|
||||
{
|
||||
userId:this.userId,
|
||||
userIds:this.selectedDeviceRowKeys
|
||||
}
|
||||
).then(res =>{
|
||||
this.$refs.userTable.$forceUpdate()
|
||||
this.visible1 =false
|
||||
this.$message.success(res.msg)
|
||||
})
|
||||
},
|
||||
//获取所有设备
|
||||
selectUserDeviceList(){
|
||||
selectUserDeviceList().then(res =>{
|
||||
this.deviceData = res.data
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 获取楼层
|
||||
getFloorDataList() {
|
||||
getFloorList().then((res) => {
|
||||
@ -510,30 +629,16 @@ export default {
|
||||
let fileName = '客户导入模板'
|
||||
|
||||
let link = document.createElement('a')
|
||||
let blob = new Blob([data], {type: 'application/vnd.ms-excel;charset=utf-8'});
|
||||
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.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()
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
URL.revokeObjectURL(link.href) // 释放URL 对象
|
||||
document.body.removeChild(link)
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user