Merge pull request 'master' (#20) from master into prod

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/20
This commit is contained in:
wenhua
2024-03-20 06:11:28 +00:00
3 changed files with 35 additions and 22 deletions

View File

@@ -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
})
}

View File

@@ -107,7 +107,7 @@ onMounted(()=>{
}
.btn-col {
display: flex;
justify-content: flex-end;
justify-content: space-evenly;
align-items: center;
}
</style>

View File

@@ -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()