feat : 用户管理主账号-新增绑定账号功能
This commit is contained in:
@@ -185,3 +185,17 @@ export const unbindAllUserByPost = (postId) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const bindAccount=(data)=>{
|
||||
return request({
|
||||
url: '/admin/mosr/user/bind/account',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export const getBindAccount=(userId)=>{
|
||||
return request({
|
||||
url: `/admin/mosr/user/bind/account/info/${userId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<template>
|
||||
<fvSearchForm ref="form" :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick"></fvTable>
|
||||
<user-picker :multiple="true" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"/>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import Tag from '@/components/Tag.vue'
|
||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import UserPicker from "@/views/workflow/process/common/UserPicker.vue";
|
||||
import { useAuthStore } from '@/stores/userstore.js'
|
||||
import { getDeptOpt, getSubCompOpt } from '../../../api/user/user.js';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { getDeptOpt, getSubCompOpt,bindAccount,getBindAccount } from '@/api/user/user.js';
|
||||
import {ElMessageBox, ElNotification} from 'element-plus';
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
@@ -75,11 +77,14 @@ const searchConfig = ref([
|
||||
])
|
||||
|
||||
const tableIns = ref()
|
||||
|
||||
const currentId = ref('')
|
||||
const userList = ref([])
|
||||
const userPicker = ref()
|
||||
const auths = {
|
||||
edit: ['admin:user:edit'],
|
||||
del: ['admin:user:del'],
|
||||
add: ['admin:user:add'],
|
||||
bindUser: ['admin:bind:account'],
|
||||
}
|
||||
|
||||
const tableConfig = reactive({
|
||||
@@ -118,12 +123,14 @@ const tableConfig = reactive({
|
||||
prop: 'accountType',
|
||||
label: '主子账号',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => (<Tag dictType={'account_type'} value={row.accountType} />)
|
||||
},
|
||||
{
|
||||
prop: 'state',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => (<Tag dictType={'normal_disable'} value={row.state} />)
|
||||
},
|
||||
{
|
||||
@@ -137,6 +144,7 @@ const tableConfig = reactive({
|
||||
fixed: 'right',
|
||||
width: '150',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
return (
|
||||
<div>
|
||||
@@ -146,7 +154,11 @@ const tableConfig = reactive({
|
||||
<el-button type="danger" v-perm={auths.del} link onClick={()=>handleDel(row)}>删除</el-button> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
row.accountType == 0 ?
|
||||
<el-button type="primary" v-perm={auths.bindUser} link onClick={()=>handleBindAccount(row)}>绑定账号</el-button> :
|
||||
null
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -207,7 +219,46 @@ const handleDel = (row) => {
|
||||
// const { code } = await
|
||||
}).catch(()=>{})
|
||||
}
|
||||
|
||||
const handleBindAccount=(row)=>{
|
||||
currentId.value = row.userId
|
||||
getBindAccount(row.userId).then(res=>{
|
||||
if(res.code != 1000){
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}else {
|
||||
userList.value = res.data
|
||||
nextTick(()=>{
|
||||
userPicker.value.showUserPicker()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const selected = (select) => {
|
||||
let userInfoList = []
|
||||
for (let val of select) {
|
||||
let userInfo = {
|
||||
id: val.id,
|
||||
name: val.name
|
||||
}
|
||||
userInfoList.push(userInfo)
|
||||
}
|
||||
userList.value = userInfoList
|
||||
let ids=userList.value.map(item=>item.id)
|
||||
let params={
|
||||
id:currentId.value,
|
||||
ids:ids
|
||||
}
|
||||
bindAccount(params).then(res=>{
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
})
|
||||
}
|
||||
const headBtnClick = (key) => {
|
||||
switch(key) {
|
||||
case 'add': handleAdd()
|
||||
|
||||
@@ -192,8 +192,12 @@ const showUserPicker = () => {
|
||||
value: "0"
|
||||
};
|
||||
dataList.value = [];
|
||||
console.log('_value.value',_value.value)
|
||||
if(props.setNullToSelectList){
|
||||
selectList.value = []
|
||||
}else {
|
||||
|
||||
selectList.value =_value.value
|
||||
}
|
||||
chooseId.value = 0;
|
||||
radio.value = 0;
|
||||
|
||||
Reference in New Issue
Block a user