fix: 修改user页面搜索配置
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import request from '@/utils/request.js'
|
||||
|
||||
// 根据角色或者部门id获取对应数据
|
||||
export const getDeptOpt = () => {
|
||||
export const getDeptOpt = (params = {}) => {
|
||||
return request({
|
||||
url: `/admin/mosr/department/option`,
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -11,35 +11,35 @@ import { getDeptOpt, getSubCompOpt } from '../../../api/user/user';
|
||||
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const localData = reactive({
|
||||
deptOption:[],
|
||||
subCompanyOpt:[],
|
||||
})
|
||||
|
||||
const deptOption = ref([])
|
||||
const subCompanyOpt = ref([])
|
||||
|
||||
const searchConfig = ref([
|
||||
{
|
||||
label: '子公司ID',
|
||||
prop: 'subCompanyId',
|
||||
component: shallowRef(fvSelect),
|
||||
component: 'el-tree-select',
|
||||
props: {
|
||||
placeholder: '请输入',
|
||||
clearable: true,
|
||||
options: [],
|
||||
filterable: true
|
||||
data: [],
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
},
|
||||
on: {
|
||||
change: async (val) =>{
|
||||
const { data } = await getDeptOpt({subCompanyId: val.value})
|
||||
searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '部门ID',
|
||||
prop: 'departmentId',
|
||||
component: 'el-cascader',
|
||||
component: 'el-tree-select',
|
||||
props: {
|
||||
placeholder: '请选择',
|
||||
clearable: true,
|
||||
options: [],
|
||||
filterable: true
|
||||
data: [],
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -108,24 +108,36 @@ const tableConfig = reactive({
|
||||
label: '创建时间',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'oper',
|
||||
label: '操作',
|
||||
fixed: 'right',
|
||||
width: '150',
|
||||
align: 'center',
|
||||
currentRender: ({row, index}) => {
|
||||
return (
|
||||
<div>
|
||||
<el-button type="primary" link>编辑</el-button>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
],
|
||||
api: '/admin/mosr/user',
|
||||
params: {}
|
||||
})
|
||||
|
||||
const init = async () => {
|
||||
// deptOption.value = await getDeptOpt()
|
||||
console.log(authStore.roles,'userinfo');
|
||||
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.options = data
|
||||
// searchConfig[1].props.options = data
|
||||
searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data
|
||||
const res = await getSubCompOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'subCompanyId').props.options = res.data
|
||||
searchConfig.value.find(item=>item.prop == 'subCompanyId').props.data = res.data
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
Reference in New Issue
Block a user