feat : 审批记录的代理审批,用户管理的设置代理功能,首页待办
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div style="padding: 0 30px">
|
||||
<baseTitle title="设置代理" ></baseTitle>
|
||||
<baseTitle title="设置代理"></baseTitle>
|
||||
<el-form ref="userForm" :model="agentInfoForm" label-width="85px">
|
||||
<el-row gutter="30">
|
||||
<el-col :span="24">
|
||||
@@ -9,14 +9,14 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="代理人" prop="" required >
|
||||
<el-form-item label="代理人" prop="" required>
|
||||
<el-button style="margin-right: 10px" color="#DED0B2" @click="handleShowAgentDialog">
|
||||
{{ agentUserList?.length !== 0 ? '更改' : '请选择' }}
|
||||
</el-button>
|
||||
<div v-for="item in agentUserList" :key="item.id" style="margin-right: 5px">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
<user-picker :multiple="false" ref="agentUserPickerRef" title="请选择代理人"
|
||||
<user-picker :multiple="false" ref="agentSettingUserPickerRef" title="请选择代理人"
|
||||
v-model:value="agentUserList" @ok="agentUserPickerOk"
|
||||
@cancelOrClear="agentUserPickerOk"/>
|
||||
</el-form-item>
|
||||
@@ -62,51 +62,55 @@
|
||||
|
||||
<script setup>
|
||||
import {ElNotification} from "element-plus";
|
||||
import UserPicker from "@/views/workflow/process/common/UserPicker.vue";
|
||||
|
||||
import {editAgentInfo, getAgentInfo} from "@/api/user/user";
|
||||
|
||||
import {editAgentInfo,getAgentInfo} from "@/api/auth/auth";
|
||||
const agentUserList = ref([])
|
||||
const agentInfoForm = ref({});
|
||||
const agentUserPickerRef = ref()
|
||||
const agentSettingUserPickerRef = ref()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
localStorage.removeItem('originallySelectedList')
|
||||
const userId = ref(route.query.userId)
|
||||
|
||||
const getUserAgentInfo = async () => {
|
||||
await getAgentInfo().then(res => {
|
||||
if(res.code===1000){
|
||||
agentInfoForm.value=res.data
|
||||
agentUserList.value=[
|
||||
await getAgentInfo(userId.value).then(res => {
|
||||
if (res.code === 1000) {
|
||||
agentInfoForm.value = res.data
|
||||
agentUserList.value = [
|
||||
{
|
||||
id:res.data.agentUserId,
|
||||
name:res.data.agentNickName,
|
||||
companyName:res.data.agentCompanyName,
|
||||
id: res.data.agentUserId,
|
||||
name: res.data.agentNickName,
|
||||
companyName: res.data.agentCompanyName,
|
||||
}
|
||||
]
|
||||
}else {
|
||||
} else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const disabledAgentEndTime = (time) => {
|
||||
return time.getTime() <= new Date(agentInfoForm.value.agentStartTime)-1 * 24 * 3600 * 1000
|
||||
return time.getTime() <= new Date(agentInfoForm.value.agentStartTime) - 1 * 24 * 3600 * 1000
|
||||
}
|
||||
|
||||
const handleShowAgentDialog = () => {
|
||||
agentUserPickerRef.value.showUserPicker()
|
||||
agentSettingUserPickerRef.value.showUserPicker()
|
||||
}
|
||||
|
||||
const agentUserPickerOk = (userList) => {
|
||||
agentUserList.value = userList
|
||||
}
|
||||
|
||||
const handleSubmitAgent=()=>{
|
||||
let agentUserId=''
|
||||
if(agentUserList.value&&agentUserList.value.length>0){
|
||||
agentUserId=agentUserList.value[0]?.id
|
||||
}else {
|
||||
const handleSubmitAgent = () => {
|
||||
let agentUserId = ''
|
||||
if (agentUserList.value && agentUserList.value.length > 0) {
|
||||
agentUserId = agentUserList.value[0]?.id
|
||||
} else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请选择代理人!',
|
||||
@@ -114,10 +118,11 @@ const handleSubmitAgent=()=>{
|
||||
})
|
||||
return;
|
||||
}
|
||||
let agentParams={
|
||||
agentUserId:agentUserId,
|
||||
agentStartTime:agentInfoForm.value.agentStartTime,
|
||||
agentEndTime:agentInfoForm.value.agentEndTime
|
||||
let agentParams = {
|
||||
userId: userId.value,
|
||||
agentUserId: agentUserId,
|
||||
agentStartTime: agentInfoForm.value.agentStartTime,
|
||||
agentEndTime: agentInfoForm.value.agentEndTime
|
||||
}
|
||||
console.info("🚀 ~method:agentParams -----", agentParams)
|
||||
editAgentInfo(agentParams).then(res => {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
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,bindAccount,getBindAccount } from '@/api/user/user.js';
|
||||
import {useAuthStore} from '@/stores/userstore.js'
|
||||
import {getDeptOpt, getSubCompOpt, bindAccount, getBindAccount} from '@/api/user/user.js';
|
||||
import {ElMessageBox, ElNotification} from 'element-plus';
|
||||
|
||||
const authStore = useAuthStore()
|
||||
@@ -29,9 +29,9 @@ const searchConfig = ref([
|
||||
remote: true
|
||||
},
|
||||
on: {
|
||||
change: async (val) =>{
|
||||
const { data } = await getDeptOpt({subCompanyId: val})
|
||||
searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data
|
||||
change: async (val) => {
|
||||
const {data} = await getDeptOpt({subCompanyId: val})
|
||||
searchConfig.value.find(item => item.prop == 'departmentId').props.data = data
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -75,7 +75,7 @@ const searchConfig = ref([
|
||||
cacheKey: 'normal_disable',
|
||||
clearable: true,
|
||||
remote: true,
|
||||
filterable:true
|
||||
filterable: true
|
||||
}
|
||||
},
|
||||
])
|
||||
@@ -99,7 +99,7 @@ const tableConfig = reactive({
|
||||
type: 'index',
|
||||
label: '序号',
|
||||
align: 'center',
|
||||
width:85,
|
||||
width: 85,
|
||||
index: index => {
|
||||
return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
|
||||
}
|
||||
@@ -140,7 +140,7 @@ const tableConfig = reactive({
|
||||
align: 'center',
|
||||
width: 100,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => (<Tag dictType={'account_type'} value={row.accountType} />)
|
||||
currentRender: ({row, index}) => (<Tag dictType={'account_type'} value={row.accountType}/>)
|
||||
},
|
||||
{
|
||||
prop: 'state',
|
||||
@@ -148,7 +148,7 @@ const tableConfig = reactive({
|
||||
width: 80,
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => (<Tag dictType={'normal_disable'} value={row.state} />)
|
||||
currentRender: ({row, index}) => (<Tag dictType={'normal_disable'} value={row.state}/>)
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
@@ -164,20 +164,22 @@ const tableConfig = reactive({
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
return (
|
||||
<div>
|
||||
<el-button type="primary" v-perm={auths.edit} link onClick={()=>handleEdit(row)}>编辑</el-button>
|
||||
<el-button type="primary" v-perm={auths.agentSetting} link onClick={()=>handleAgentSetting(row)}>设置代理</el-button>
|
||||
{
|
||||
row.userType != 0 ?
|
||||
<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>
|
||||
<div>
|
||||
<el-button type="primary" v-perm={auths.edit} link onClick={() => handleEdit(row)}>编辑</el-button>
|
||||
<el-button type="primary" v-perm={auths.agentSetting} link onClick={() => handleAgentSetting(row)}>设置代理
|
||||
</el-button>
|
||||
{
|
||||
row.userType != 0 ?
|
||||
<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>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -185,24 +187,27 @@ const tableConfig = reactive({
|
||||
api: '/admin/mosr/user',
|
||||
params: {},
|
||||
btns: [
|
||||
{name: '新增', color:"#DED0B2", auth: ['admin:user:add'], key: 'add'}
|
||||
{name: '新增', color: "#DED0B2", auth: ['admin:user:add'], key: 'add'}
|
||||
]
|
||||
})
|
||||
const handleAgentSetting=()=>{
|
||||
const handleAgentSetting = (row) => {
|
||||
router.push({
|
||||
name: 'AgentSetting',
|
||||
query: {
|
||||
userId: row.userId,
|
||||
}
|
||||
})
|
||||
}
|
||||
const init = async () => {
|
||||
// console.log(authStore.roles,'userinfo');
|
||||
if(!authStore.roles.includes('superAdmin')) {
|
||||
if (!authStore.roles.includes('superAdmin')) {
|
||||
searchConfig.value = searchConfig.value.slice(1)
|
||||
}
|
||||
searchConfig.value = searchConfig.value
|
||||
const { data } = await getDeptOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data
|
||||
const {data} = await getDeptOpt()
|
||||
searchConfig.value.find(item => item.prop == 'departmentId').props.data = data
|
||||
const res = await getSubCompOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'subCompanyId').props.data = res.data
|
||||
searchConfig.value.find(item => item.prop == 'subCompanyId').props.data = res.data
|
||||
// console.log("🚀 ~ init ~ searchConfig.value:", searchConfig.value)
|
||||
}
|
||||
|
||||
@@ -239,20 +244,21 @@ const handleDel = (row) => {
|
||||
cancelButtonText: '取消'
|
||||
}).then(async res => {
|
||||
// const { code } = await
|
||||
}).catch(()=>{})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
const handleBindAccount=(row)=>{
|
||||
const handleBindAccount = (row) => {
|
||||
currentId.value = row.userId
|
||||
getBindAccount(row.userId).then(res=>{
|
||||
if(res.code != 1000){
|
||||
getBindAccount(row.userId).then(res => {
|
||||
if (res.code != 1000) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
userList.value = res.data
|
||||
nextTick(()=>{
|
||||
nextTick(() => {
|
||||
userPicker.value.showUserPicker()
|
||||
})
|
||||
}
|
||||
@@ -268,12 +274,12 @@ const selected = (select) => {
|
||||
userInfoList.push(userInfo)
|
||||
}
|
||||
userList.value = userInfoList
|
||||
let ids=userList.value.map(item=>item.id)
|
||||
let params={
|
||||
id:currentId.value,
|
||||
ids:ids
|
||||
let ids = userList.value.map(item => item.id)
|
||||
let params = {
|
||||
id: currentId.value,
|
||||
ids: ids
|
||||
}
|
||||
bindAccount(params).then(res=>{
|
||||
bindAccount(params).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
@@ -282,8 +288,9 @@ const selected = (select) => {
|
||||
})
|
||||
}
|
||||
const headBtnClick = (key) => {
|
||||
switch(key) {
|
||||
case 'add': handleAdd()
|
||||
switch (key) {
|
||||
case 'add':
|
||||
handleAdd()
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -304,7 +311,8 @@ const headBtnClick = (key) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-col-5:nth-child(4).el-col-offset-1){
|
||||
|
||||
:deep(.el-col-5:nth-child(4).el-col-offset-1) {
|
||||
margin-left: 35px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user