Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -46,6 +46,15 @@ export const getUserDetail = (userId) => {
|
|||||||
method: "get"
|
method: "get"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 操作
|
||||||
|
export const operate = (data, type) => {
|
||||||
|
console.log(type ,'type');
|
||||||
|
if(data.userId && type !== '0') return editUser(data)
|
||||||
|
else if(type == '0') return editUserOA(data)
|
||||||
|
return addUser(data)
|
||||||
|
}
|
||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
export const addUser = (data) => {
|
export const addUser = (data) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -63,6 +72,15 @@ export const editUser = (data) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改OA用户
|
||||||
|
export const editUserOA = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/mosr/user/oa',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//删除用户信息
|
//删除用户信息
|
||||||
export const deleteUser = (userId) => {
|
export const deleteUser = (userId) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import { addUser, editUser } from '@/api/user/user.js'
|
import { operate } from '@/api/user/user.js'
|
||||||
import { ElLoading, ElNotification } from 'element-plus';
|
import { ElLoading, ElNotification } from 'element-plus';
|
||||||
import { useTagsView } from '@/stores/tagsview.js'
|
import { useTagsView } from '@/stores/tagsview.js'
|
||||||
import { useAuthStore } from '@/stores/userstore.js'
|
import { useAuthStore } from '@/stores/userstore.js'
|
||||||
@@ -43,7 +43,8 @@ const schame = computed(()=>{
|
|||||||
clearable: true,
|
clearable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
data: localData.subCompanyIdOpt
|
data: localData.subCompanyIdOpt,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
change: async (val) => {
|
change: async (val) => {
|
||||||
@@ -61,7 +62,8 @@ const schame = computed(()=>{
|
|||||||
clearable: true,
|
clearable: true,
|
||||||
data: localData.departmentIdOpt,
|
data: localData.departmentIdOpt,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true
|
checkStrictly: true,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'userName',
|
prop: 'userName',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -77,7 +80,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'nickName',
|
prop: 'nickName',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -86,7 +90,7 @@ const schame = computed(()=>{
|
|||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入',
|
placeholder: '请输入',
|
||||||
type: 'password'
|
type: 'password',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -97,7 +101,8 @@ const schame = computed(()=>{
|
|||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
data: localData.jobOpt
|
data: localData.jobOpt,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -116,7 +121,8 @@ const schame = computed(()=>{
|
|||||||
component: 'el-tree-select',
|
component: 'el-tree-select',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
data: cacheStore.getDict('user_sex')
|
data: cacheStore.getDict('user_sex'),
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -125,7 +131,8 @@ const schame = computed(()=>{
|
|||||||
component: 'el-tree-select',
|
component: 'el-tree-select',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
data: cacheStore.getDict('normal_disable')
|
data: cacheStore.getDict('normal_disable'),
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -133,7 +140,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'mobile',
|
prop: 'mobile',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -141,7 +149,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'email',
|
prop: 'email',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -198,30 +207,20 @@ const getInfo = async () => {
|
|||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const loading = ElLoading.service({fullscreen: true})
|
const loading = ElLoading.service({fullscreen: true})
|
||||||
try {
|
const { isValidate } = await form.value.validate()
|
||||||
const { isValidate } = await form.value.validate()
|
if(!isValidate) return Promise.reject()
|
||||||
if(!isValidate) return Promise.reject()
|
const values = form.value.getValues()
|
||||||
const values = form.value.getValues()
|
operate(values, route.query.userType).then(res=>{
|
||||||
let message
|
|
||||||
if(route.query.isAdd) {
|
|
||||||
const { code, msg } = await addUser(values)
|
|
||||||
code === 1000 ? message = msg : null
|
|
||||||
} else {
|
|
||||||
const { code, msg } = await editUser(values)
|
|
||||||
code === 1000 ? message = msg : null
|
|
||||||
}
|
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: route.query.isAdd ? '新增' : '编辑',
|
title: route.query.isAdd ? '新增' : '编辑',
|
||||||
message: message,
|
message: res.msg,
|
||||||
type: 'success'
|
type: res.code === 1000 ? 'success' : 'error'
|
||||||
})
|
})
|
||||||
loading.close()
|
loading.close()
|
||||||
tagsViewStore.delViewAndGoView('/system/user')
|
res.code === 1000 ? tagsViewStore.delViewAndGoView('/system/user') : null
|
||||||
} catch {
|
}).finally(()=>{
|
||||||
loading.close()
|
loading.close()
|
||||||
return Promise.reject()
|
})
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
|
|||||||
@@ -119,14 +119,8 @@ const tableConfig = reactive({
|
|||||||
currentRender: ({row, index}) => {
|
currentRender: ({row, index}) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{
|
<el-button type="primary" link onClick={()=>handleEdit(row)}>编辑</el-button>
|
||||||
row.userType == 0 ?
|
<el-button type="danger" link onClick={()=>handleDel(row)}>删除</el-button>
|
||||||
'--' :
|
|
||||||
<div>
|
|
||||||
<el-button type="primary" link onClick={()=>handleEdit(row)}>编辑</el-button>
|
|
||||||
<el-button type="danger" link onClick={()=>handleDel(row)}>删除</el-button>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -171,7 +165,8 @@ const handleEdit = (row) => {
|
|||||||
router.push({
|
router.push({
|
||||||
path: '/system/useredit',
|
path: '/system/useredit',
|
||||||
query: {
|
query: {
|
||||||
id: row.userId
|
id: row.userId,
|
||||||
|
userType: row.userType
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user