2024-02-25 11:17:16 +08:00
|
|
|
<template>
|
|
|
|
<a-modal
|
2024-10-08 16:51:42 +08:00
|
|
|
title="操作"
|
|
|
|
style="top: 20px;"
|
|
|
|
:width="800"
|
|
|
|
v-model="visible"
|
|
|
|
:confirmLoading="confirmLoading"
|
|
|
|
@ok="handleSubmit"
|
2024-02-25 11:17:16 +08:00
|
|
|
>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form :form="form">
|
|
|
|
<a-form-item style="display:none">
|
2024-03-27 14:29:26 +08:00
|
|
|
<a-input v-decorator="['id']" />
|
2024-02-25 11:17:16 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="姓名">
|
|
|
|
<a-input placeholder="姓名" v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" />
|
2024-02-25 11:17:16 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="电话">
|
|
|
|
<a-input placeholder="电话" v-decorator="['mobile', {rules: [{required: true, message: '请输入电话'}]}]" />
|
2024-02-25 11:17:16 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="用户性别">
|
|
|
|
<a-radio-group @change="onChange" v-decorator="['gender',{rules: [{required: true, message: '请选择性别'}]}]">
|
2024-02-25 11:17:16 +08:00
|
|
|
<a-radio :value="'0'">男</a-radio>
|
|
|
|
<a-radio :value="'1'">女</a-radio>
|
|
|
|
</a-radio-group>
|
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<!-- <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='照片'>-->
|
|
|
|
<!-- <a-upload-->
|
|
|
|
<!-- v-decorator="['photo' ,{rules: [{required: true, message: '请上传照片'}]}]"-->
|
|
|
|
<!-- list-type='picture-card'-->
|
|
|
|
<!-- class='avatar-uploader'-->
|
|
|
|
<!-- :show-upload-list='false'-->
|
|
|
|
<!-- :action='uploadUrl'-->
|
|
|
|
<!-- :headers='headers'-->
|
|
|
|
<!-- :before-upload='photoBeforeUpload'-->
|
|
|
|
<!-- @change='photoHandleChange'-->
|
|
|
|
<!-- >-->
|
|
|
|
<!-- <img v-if='photoImageUrl' :src='photoImageUrl' style='width: 102px; height: 102px' />-->
|
|
|
|
<!-- <div v-else>-->
|
|
|
|
<!-- <a-icon :type="photoLoading ? 'loading' : 'plus'" />-->
|
|
|
|
<!-- <div class='ant-upload-text'> 上传</div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </a-upload>-->
|
|
|
|
<!-- </a-form-item>-->
|
|
|
|
<!-- <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='头像'>-->
|
|
|
|
<!-- <a-upload-->
|
|
|
|
<!-- v-decorator="['avatar']"-->
|
|
|
|
<!-- list-type='picture-card'-->
|
|
|
|
<!-- class='avatar-uploader'-->
|
|
|
|
<!-- :show-upload-list='false'-->
|
|
|
|
<!-- :action='uploadUrl'-->
|
|
|
|
<!-- :headers='headers'-->
|
|
|
|
<!-- :before-upload='avatarBeforeUpload'-->
|
|
|
|
<!-- @change='avatarHandleChange'-->
|
|
|
|
<!-- >-->
|
|
|
|
<!-- <img v-if='avatarImageUrl' :src='avatarImageUrl' style='width: 102px; height: 102px' />-->
|
|
|
|
<!-- <div v-else>-->
|
|
|
|
<!-- <a-icon :type="avatarLoading ? 'loading' : 'plus'" />-->
|
|
|
|
<!-- <div class='ant-upload-text'> 上传</div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </a-upload>-->
|
|
|
|
<!-- </a-form-item>-->
|
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="随手拍角色">
|
|
|
|
<a-radio-group v-decorator="['dataType',{rules: [{required: true, message: '请选择随手拍角色'}]}]">
|
|
|
|
<a-radio :value="'1'">普通用户</a-radio>
|
|
|
|
<a-radio :value="'3'">派单员</a-radio>
|
|
|
|
<a-radio :value="'5'">维修人</a-radio>
|
|
|
|
<a-radio :value="'7'">管理员</a-radio>
|
|
|
|
<a-radio :value="'9'">楼层管理员</a-radio>
|
|
|
|
</a-radio-group>
|
2024-03-27 11:38:47 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="会议室角色">
|
|
|
|
<a-radio-group v-decorator="['roomRole']">
|
|
|
|
<a-radio :value="1">普通用户</a-radio>
|
|
|
|
<a-radio :value="3">会议服务人员</a-radio>
|
|
|
|
<a-radio :value="5">会议管理员</a-radio>
|
|
|
|
</a-radio-group>
|
2024-03-27 11:38:47 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="会议服务组">
|
|
|
|
<a-radio-group v-decorator="['roomRoleType']">
|
|
|
|
<a-radio :value="1">音控组</a-radio>
|
|
|
|
<a-radio :value="3">会务服务组</a-radio>
|
|
|
|
</a-radio-group>
|
2024-03-27 11:38:47 +08:00
|
|
|
</a-form-item>
|
2024-10-08 16:51:42 +08:00
|
|
|
|
|
|
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="昵称">
|
|
|
|
<a-input placeholder="昵称" v-decorator="['username']" />
|
2024-03-27 11:38:47 +08:00
|
|
|
</a-form-item>
|
|
|
|
|
2024-02-25 11:17:16 +08:00
|
|
|
</a-form>
|
|
|
|
</a-modal>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { saveIcsCustomerStaff } from '@/api/admin/icsCustomerStaff'
|
2024-03-27 14:29:26 +08:00
|
|
|
import {
|
|
|
|
getCustomerList
|
|
|
|
} from '@/api/admin/meeting/roomContent'
|
|
|
|
|
2024-02-25 11:17:16 +08:00
|
|
|
import pick from 'lodash.pick'
|
2024-03-27 11:38:47 +08:00
|
|
|
import storage from 'store'
|
|
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
2024-03-27 14:29:26 +08:00
|
|
|
|
2024-02-25 11:17:16 +08:00
|
|
|
export default {
|
|
|
|
name: 'IcsCustomerStaffModal',
|
2024-03-27 14:29:26 +08:00
|
|
|
props: {},
|
|
|
|
components: {},
|
2024-10-08 16:51:42 +08:00
|
|
|
data () {
|
2024-02-25 11:17:16 +08:00
|
|
|
return {
|
|
|
|
visible: false,
|
|
|
|
labelCol: {
|
|
|
|
xs: { span: 24 },
|
|
|
|
sm: { span: 5 }
|
|
|
|
},
|
|
|
|
wrapperCol: {
|
|
|
|
xs: { span: 24 },
|
|
|
|
sm: { span: 16 }
|
|
|
|
},
|
2024-03-27 11:38:47 +08:00
|
|
|
uploadUrl: process.env.VUE_APP_API_BASE_URL + '/api/dfs/upload',
|
|
|
|
imageUrl: '',
|
|
|
|
headers: {
|
|
|
|
Authorization: 'Bearer ' + storage.get(ACCESS_TOKEN)
|
|
|
|
},
|
2024-02-25 11:17:16 +08:00
|
|
|
confirmLoading: false,
|
|
|
|
mdl: {},
|
2024-03-27 14:29:26 +08:00
|
|
|
form: this.$form.createForm(this),
|
|
|
|
customerList: [],
|
|
|
|
photoImageUrl: '',
|
|
|
|
photoLoading: false,
|
|
|
|
avatarImageUrl: '',
|
|
|
|
avatarLoading: false
|
2024-02-25 11:17:16 +08:00
|
|
|
}
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
beforeCreate () {
|
2024-02-25 11:17:16 +08:00
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
created () {
|
2024-02-25 11:17:16 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2024-03-27 14:29:26 +08:00
|
|
|
// 照片
|
2024-10-08 16:51:42 +08:00
|
|
|
photoBeforeUpload (file) {
|
2024-03-27 11:38:47 +08:00
|
|
|
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
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
photoHandleChange (info) {
|
2024-03-27 11:38:47 +08:00
|
|
|
if (info.file.status === 'uploading') {
|
2024-03-27 14:29:26 +08:00
|
|
|
this.photoLoading = true
|
2024-03-27 11:38:47 +08:00
|
|
|
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.
|
2024-03-27 14:29:26 +08:00
|
|
|
this.getBase64(info.file.originFileObj, imageUrl => {
|
|
|
|
this.photoImageUrl = imageUrl
|
|
|
|
this.photoLoading = false
|
2024-03-27 11:38:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
2024-03-27 14:29:26 +08:00
|
|
|
// 头像
|
2024-10-08 16:51:42 +08:00
|
|
|
avatarBeforeUpload (file) {
|
2024-03-27 11:38:47 +08:00
|
|
|
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
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
avatarHandleChange (info) {
|
2024-03-27 11:38:47 +08:00
|
|
|
if (info.file.status === 'uploading') {
|
2024-03-27 14:29:26 +08:00
|
|
|
this.avatarLoading = true
|
2024-03-27 11:38:47 +08:00
|
|
|
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.
|
2024-03-27 14:29:26 +08:00
|
|
|
this.getBase64(info.file.originFileObj, imageUrl => {
|
|
|
|
this.avatarImageUrl = imageUrl
|
|
|
|
this.avatarLoading = false
|
2024-03-27 11:38:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
getBase64 (img, callback) {
|
2024-03-27 14:29:26 +08:00
|
|
|
const reader = new FileReader()
|
|
|
|
reader.addEventListener('load', () => callback(reader.result))
|
|
|
|
reader.readAsDataURL(img)
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
add () {
|
2024-02-25 11:17:16 +08:00
|
|
|
this.form.resetFields()
|
|
|
|
this.edit({ id: 0 })
|
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
edit (record) {
|
|
|
|
console.log(record)
|
2024-03-27 14:29:26 +08:00
|
|
|
// 查询企业
|
|
|
|
getCustomerList().then(res => {
|
|
|
|
console.log('getCustomerList', res)
|
|
|
|
this.customerList = res.rows
|
|
|
|
})
|
2024-02-25 11:17:16 +08:00
|
|
|
this.mdl = Object.assign(record)
|
|
|
|
this.visible = true
|
|
|
|
this.$nextTick(() => {
|
2024-10-08 16:51:42 +08:00
|
|
|
this.form.setFieldsValue(pick(this.mdl, 'id', 'icsCustomerId', 'name', 'mobile', 'gender', 'photo', 'avatar', 'dataType', 'roomRole', 'roomRoleType', 'username', 'cardNo', 'address', 'email', 'degree', 'urgent'))
|
2024-02-25 11:17:16 +08:00
|
|
|
})
|
2024-03-27 14:29:26 +08:00
|
|
|
//
|
|
|
|
if (this.mdl.photo) {
|
|
|
|
this.photoImageUrl = process.env.VUE_APP_API_BASE_URL + this.mdl.photo
|
|
|
|
} else {
|
|
|
|
this.photoImageUrl = ''
|
|
|
|
}
|
|
|
|
if (this.mdl.avatar) {
|
|
|
|
this.avatarImageUrl = process.env.VUE_APP_API_BASE_URL + this.mdl.avatar
|
|
|
|
} else {
|
|
|
|
this.avatarImageUrl = ''
|
|
|
|
}
|
2024-02-25 11:17:16 +08:00
|
|
|
},
|
2024-10-08 16:51:42 +08:00
|
|
|
handleSubmit (e) {
|
2024-02-25 11:17:16 +08:00
|
|
|
e.preventDefault()
|
|
|
|
this.form.validateFields((err, values) => {
|
|
|
|
if (!err) {
|
|
|
|
console.log('Received values of form: ', values)
|
|
|
|
this.confirmLoading = true
|
|
|
|
console.log('Received values of form: ')
|
|
|
|
saveIcsCustomerStaff(values).then(res => {
|
2024-10-08 16:51:42 +08:00
|
|
|
console.log(111)
|
2024-02-25 11:17:16 +08:00
|
|
|
if (res.code === 0) {
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
this.$emit('ok')
|
|
|
|
this.visible = false
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
}).catch(() => {
|
|
|
|
this.$message.error('系统错误,请稍后再试')
|
|
|
|
}).finally(() => {
|
|
|
|
this.confirmLoading = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
/*
|
|
|
|
'selectedRows': function (selectedRows) {
|
|
|
|
this.needTotalList = this.needTotalList.map(item => {
|
|
|
|
return {
|
|
|
|
...item,
|
|
|
|
total: selectedRows.reduce( (sum, val) => {
|
|
|
|
return sum + val[item.dataIndex]
|
|
|
|
}, 0)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|