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' import request from '@/utils/request.js'
// 根据角色或者部门id获取对应数据 // 根据角色或者部门id获取对应数据
export const getDeptOpt = () => { export const getDeptOpt = (params = {}) => {
return request({ return request({
url: `/admin/mosr/department/option`, url: `/admin/mosr/department/option`,
method: 'get' method: 'get',
params
}) })
} }

View File

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

View File

@@ -11,35 +11,35 @@ import { getDeptOpt, getSubCompOpt } from '../../../api/user/user';
const authStore = useAuthStore() const authStore = useAuthStore()
const localData = reactive({
deptOption:[],
subCompanyOpt:[],
})
const deptOption = ref([])
const subCompanyOpt = ref([])
const searchConfig = ref([ const searchConfig = ref([
{ {
label: '子公司ID', label: '子公司ID',
prop: 'subCompanyId', prop: 'subCompanyId',
component: shallowRef(fvSelect), component: 'el-tree-select',
props: { props: {
placeholder: '请输入', placeholder: '请输入',
clearable: true, clearable: true,
options: [], data: [],
filterable: true 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', label: '部门ID',
prop: 'departmentId', prop: 'departmentId',
component: 'el-cascader', component: 'el-tree-select',
props: { props: {
placeholder: '请选择', placeholder: '请选择',
clearable: true, clearable: true,
options: [], data: [],
filterable: true filterable: true,
checkStrictly: true
} }
}, },
{ {
@@ -108,24 +108,36 @@ const tableConfig = reactive({
label: '创建时间', label: '创建时间',
align: 'center', 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', api: '/admin/mosr/user',
params: {} params: {}
}) })
const init = async () => { const init = async () => {
// deptOption.value = await getDeptOpt()
console.log(authStore.roles,'userinfo'); 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.slice(1)
} }
searchConfig.value = searchConfig.value searchConfig.value = searchConfig.value
const { data } = await getDeptOpt() const { data } = await getDeptOpt()
searchConfig.value.find(item=>item.prop == 'departmentId').props.options = data searchConfig.value.find(item=>item.prop == 'departmentId').props.data = data
// searchConfig[1].props.options = data
const res = await getSubCompOpt() 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() init()