- 新增CompanySelector组件: 仅crossDomain权限或SUPER_ADMIN可见 - 权限分配页: 全局系统特权下新增"允许全局跨域"操作权限checkbox - 入库汇总/出库记录搜索栏嵌入CompanySelector - PermissionConfig: transformData识别crossDomain为操作权限码
56 lines
1.3 KiB
Vue
56 lines
1.3 KiB
Vue
<template>
|
|
<el-select
|
|
v-if="hasCrossDomain"
|
|
:model-value="modelValue"
|
|
placeholder="全部部门/公司"
|
|
clearable
|
|
style="width: 180px;"
|
|
@update:model-value="$emit('update:modelValue', $event)"
|
|
@change="$emit('change', $event)"
|
|
>
|
|
<el-option label="全部部门/公司" value="" />
|
|
<el-option
|
|
v-for="c in companies"
|
|
:key="c"
|
|
:label="c"
|
|
:value="c"
|
|
/>
|
|
</el-select>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import { useUserStore } from '@/stores/user'
|
|
import { getFilterOptions } from '@/api/inbound/buy'
|
|
|
|
const props = defineProps<{
|
|
modelValue?: string
|
|
}>()
|
|
|
|
defineEmits<{
|
|
'update:modelValue': [value: string]
|
|
change: [value: string]
|
|
}>()
|
|
|
|
const userStore = useUserStore()
|
|
const companies = ref<string[]>([])
|
|
|
|
const hasCrossDomain = computed(() => {
|
|
const role = (userStore.role || '').toUpperCase()
|
|
if (role === 'SUPER_ADMIN') return true
|
|
return userStore.hasPermission('crossDomain')
|
|
})
|
|
|
|
onMounted(async () => {
|
|
if (!hasCrossDomain.value) return
|
|
try {
|
|
const res: any = await getFilterOptions()
|
|
if (res.code === 200) {
|
|
companies.value = res.data.companies || []
|
|
}
|
|
} catch (e) {
|
|
console.error('获取公司列表失败', e)
|
|
}
|
|
})
|
|
</script>
|