新增了小程序用户页面

This commit is contained in:
chenze 2024-10-08 16:51:42 +08:00
parent 1259f068a8
commit 7d028cce22
2 changed files with 117 additions and 91 deletions

View File

@ -36,20 +36,39 @@
:columns='columns' :columns='columns'
:data='loadData' :data='loadData'
> >
<!-- 数据类型1.普通用户3派单员5 维修人, 7管理员, 9 楼层管理员-->
<span slot='dataType' slot-scope='text,record'> <span slot='dataType' slot-scope='text,record'>
<a-tag v-if='record.dataType == 1' color='pink'> <a-tag v-if='record.dataType == 1' color='pink'>
维修员 普通用户
</a-tag> </a-tag>
<a-tag v-if='record.dataType == 2' color='green'> <a-tag v-if='record.dataType == 3' color='green'>
派单员 派单员
</a-tag> </a-tag>
<a-tag v-if='record.dataType == 3' color='green'> <a-tag v-if='record.dataType == 5' color='cyan'>
网格长 维修人
</a-tag>
<a-tag v-if='record.dataType == 7' color='blue'>
管理员
</a-tag>
<a-tag v-if='record.dataType == 9' color='purple'>
楼层管理员
</a-tag> </a-tag>
</span>
<span slot='roomRole' slot-scope='text,record'>
<a-tag v-if='record.roomRole == 1' color='pink'>
普通用户
</a-tag>
<a-tag v-if='record.roomRole == 2' color='green'>
派单员
</a-tag>
<a-tag v-if='record.roomRole == 5' color='cyan'>
维修人
</a-tag>
</span> </span>
<span slot='action' slot-scope='text, record'> <span slot='action' slot-scope='text, record'>
<!-- <a v-if='editEnabel' @click='handleEdit(record)'>编辑</a>--> <a v-if='editEnabel' @click='handleEdit(record)'>编辑</a>
<!-- <a-divider type='vertical' />--> <a-divider type='vertical' />
<a v-if='removeEnable' @click='delByIds([record.id])'>删除</a> <a v-if='removeEnable' @click='delByIds([record.id])'>删除</a>
</span> </span>
</s-table> </s-table>
@ -97,10 +116,15 @@ export default {
dataIndex: 'mobile' dataIndex: 'mobile'
}, },
{ {
title: '角色类型', title: '报修角色类型',
dataIndex: 'dataType', dataIndex: 'dataType',
scopedSlots: { customRender: 'dataType' } scopedSlots: { customRender: 'dataType' }
}, },
{
title: '会议角色类型',
dataIndex: 'roomRole',
scopedSlots: { customRender: 'roomRole' }
},
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime' dataIndex: 'createTime'

View File

@ -1,89 +1,89 @@
<template> <template>
<a-modal <a-modal
title='操作' title="操作"
style='top: 20px;' style="top: 20px;"
:width='800' :width="800"
v-model='visible' v-model="visible"
:confirmLoading='confirmLoading' :confirmLoading="confirmLoading"
@ok='handleSubmit' @ok="handleSubmit"
> >
<a-form :form='form'> <a-form :form="form">
<a-form-item style='display:none'> <a-form-item style="display:none">
<a-input v-decorator="['id']" /> <a-input v-decorator="['id']" />
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='企业'> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="姓名">
<a-select v-decorator="['icsCustomerId',{rules: [{ required: true, message: '请选择企业' }]}]" <a-input placeholder="姓名" v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" />
placeholder='企业'>
<a-select-option v-for='item in customerList' :key='item.id' :value='item.id'>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='姓名'> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="电话">
<a-input placeholder='姓名' v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" /> <a-input placeholder="电话" v-decorator="['mobile', {rules: [{required: true, message: '请输入电话'}]}]" />
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='电话'> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="用户性别">
<a-input placeholder='电话' v-decorator="['mobile', {rules: [{required: true, message: '请输入电话'}]}]" /> <a-radio-group @change="onChange" v-decorator="['gender',{rules: [{required: true, message: '请选择性别'}]}]">
</a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='用户性别'>
<a-radio-group @change='onChange' v-decorator="['gender',{rules: [{required: true, message: '请选择性别'}]}]">
<a-radio :value="'0'"></a-radio> <a-radio :value="'0'"></a-radio>
<a-radio :value="'1'"></a-radio> <a-radio :value="'1'"></a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='照片'> <!-- <a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='照片'>-->
<a-upload <!-- <a-upload-->
v-decorator="['photo' ,{rules: [{required: true, message: '请上传照片'}]}]" <!-- v-decorator="['photo' ,{rules: [{required: true, message: '请上传照片'}]}]"-->
list-type='picture-card' <!-- list-type='picture-card'-->
class='avatar-uploader' <!-- class='avatar-uploader'-->
:show-upload-list='false' <!-- :show-upload-list='false'-->
:action='uploadUrl' <!-- :action='uploadUrl'-->
:headers='headers' <!-- :headers='headers'-->
:before-upload='photoBeforeUpload' <!-- :before-upload='photoBeforeUpload'-->
@change='photoHandleChange' <!-- @change='photoHandleChange'-->
> <!-- >-->
<img v-if='photoImageUrl' :src='photoImageUrl' style='width: 102px; height: 102px' /> <!-- <img v-if='photoImageUrl' :src='photoImageUrl' style='width: 102px; height: 102px' />-->
<div v-else> <!-- <div v-else>-->
<a-icon :type="photoLoading ? 'loading' : 'plus'" /> <!-- <a-icon :type="photoLoading ? 'loading' : 'plus'" />-->
<div class='ant-upload-text'> 上传</div> <!-- <div class='ant-upload-text'> 上传</div>-->
</div> <!-- </div>-->
</a-upload> <!-- </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>
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='头像'> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="会议室角色">
<a-upload <a-radio-group v-decorator="['roomRole']">
v-decorator="['avatar']" <a-radio :value="1">普通用户</a-radio>
list-type='picture-card' <a-radio :value="3">会议服务人员</a-radio>
class='avatar-uploader' <a-radio :value="5">会议管理员</a-radio>
:show-upload-list='false' </a-radio-group>
: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>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='昵称'> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="会议服务组">
<a-input placeholder='昵称' v-decorator="['username']" /> <a-radio-group v-decorator="['roomRoleType']">
<a-radio :value="1">音控组</a-radio>
<a-radio :value="3">会务服务组</a-radio>
</a-radio-group>
</a-form-item> </a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='身份证号'>
<a-input placeholder='身份证号' v-decorator="['cardNo']" /> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="昵称">
</a-form-item> <a-input placeholder="昵称" v-decorator="['username']" />
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='地址'>
<a-input placeholder='地址' v-decorator="['address' ,{rules: [{required: true, message: '请输入地址'}]}]" />
</a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='邮箱'>
<a-input placeholder='邮箱' v-decorator="['email']" />
</a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='学历'>
<a-input placeholder='学历' v-decorator="['degree']" />
</a-form-item>
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='紧急联系人'>
<a-input placeholder='紧急联系人' v-decorator="['urgent']" />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -103,7 +103,7 @@ export default {
name: 'IcsCustomerStaffModal', name: 'IcsCustomerStaffModal',
props: {}, props: {},
components: {}, components: {},
data() { data () {
return { return {
visible: false, visible: false,
labelCol: { labelCol: {
@ -129,13 +129,13 @@ export default {
avatarLoading: false avatarLoading: false
} }
}, },
beforeCreate() { beforeCreate () {
}, },
created() { created () {
}, },
methods: { methods: {
// //
photoBeforeUpload(file) { photoBeforeUpload (file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
if (!isJpgOrPng) { if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!') this.$message.error('You can only upload JPG file!')
@ -146,7 +146,7 @@ export default {
} }
return isJpgOrPng && isLt2M return isJpgOrPng && isLt2M
}, },
photoHandleChange(info) { photoHandleChange (info) {
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
this.photoLoading = true this.photoLoading = true
return return
@ -169,7 +169,7 @@ export default {
} }
}, },
// //
avatarBeforeUpload(file) { avatarBeforeUpload (file) {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
if (!isJpgOrPng) { if (!isJpgOrPng) {
this.$message.error('You can only upload JPG file!') this.$message.error('You can only upload JPG file!')
@ -180,7 +180,7 @@ export default {
} }
return isJpgOrPng && isLt2M return isJpgOrPng && isLt2M
}, },
avatarHandleChange(info) { avatarHandleChange (info) {
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
this.avatarLoading = true this.avatarLoading = true
return return
@ -202,16 +202,17 @@ export default {
}) })
} }
}, },
getBase64(img, callback) { getBase64 (img, callback) {
const reader = new FileReader() const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result)) reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img) reader.readAsDataURL(img)
}, },
add() { add () {
this.form.resetFields() this.form.resetFields()
this.edit({ id: 0 }) this.edit({ id: 0 })
}, },
edit(record) { edit (record) {
console.log(record)
// //
getCustomerList().then(res => { getCustomerList().then(res => {
console.log('getCustomerList', res) console.log('getCustomerList', res)
@ -220,7 +221,7 @@ export default {
this.mdl = Object.assign(record) this.mdl = Object.assign(record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.mdl, 'id', 'icsCustomerId', 'name', 'mobile', 'gender', 'photo', 'avatar', 'username', 'cardNo', 'address', 'email', 'degree', 'urgent')) this.form.setFieldsValue(pick(this.mdl, 'id', 'icsCustomerId', 'name', 'mobile', 'gender', 'photo', 'avatar', 'dataType', 'roomRole', 'roomRoleType', 'username', 'cardNo', 'address', 'email', 'degree', 'urgent'))
}) })
// //
if (this.mdl.photo) { if (this.mdl.photo) {
@ -234,7 +235,7 @@ export default {
this.avatarImageUrl = '' this.avatarImageUrl = ''
} }
}, },
handleSubmit(e) { handleSubmit (e) {
e.preventDefault() e.preventDefault()
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
@ -242,6 +243,7 @@ export default {
this.confirmLoading = true this.confirmLoading = true
console.log('Received values of form: ') console.log('Received values of form: ')
saveIcsCustomerStaff(values).then(res => { saveIcsCustomerStaff(values).then(res => {
console.log(111)
if (res.code === 0) { if (res.code === 0) {
this.$message.success('保存成功') this.$message.success('保存成功')
this.$emit('ok') this.$emit('ok')