Compare commits
2 Commits
36661d1420
...
638b13ac3e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
638b13ac3e | ||
![]() |
00fe257cf5 |
@ -2,9 +2,8 @@
|
|||||||
import { usePermissionStore } from '@/store/modules/permission'
|
import { usePermissionStore } from '@/store/modules/permission'
|
||||||
import { useAppStore } from '@/store/modules/app'
|
import { useAppStore } from '@/store/modules/app'
|
||||||
|
|
||||||
import { ElScrollbar } from 'element-plus'
|
import { ElScrollbar, ElMenu, ElMenuItem } from 'element-plus'
|
||||||
import { Icon } from '@/components/Icon'
|
import { Icon } from '@/components/Icon'
|
||||||
import { Menu } from '@/layout/components/Menu'
|
|
||||||
import { pathResolve } from '@/utils/routerHelper'
|
import { pathResolve } from '@/utils/routerHelper'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import { filterMenusPath, initTabMap, tabPathMap } from './helper'
|
import { filterMenusPath, initTabMap, tabPathMap } from './helper'
|
||||||
@ -34,10 +33,6 @@ export default defineComponent({
|
|||||||
|
|
||||||
const tabRouters = computed(() => unref(routers).filter((v) => !v?.meta?.hidden))
|
const tabRouters = computed(() => unref(routers).filter((v) => !v?.meta?.hidden))
|
||||||
|
|
||||||
const setCollapse = () => {
|
|
||||||
appStore.setCollapse(!unref(collapse))
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (unref(fixedMenu)) {
|
if (unref(fixedMenu)) {
|
||||||
const path = `/${unref(currentRoute).path.split('/')[1]}`
|
const path = `/${unref(currentRoute).path.split('/')[1]}`
|
||||||
@ -57,9 +52,30 @@ export default defineComponent({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.addEventListener('resize', setVisibleNumber);
|
||||||
|
setVisibleNumber()
|
||||||
appStore.setCollapse(true)
|
appStore.setCollapse(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 可渲染菜单的数量
|
||||||
|
const visibleNumber = ref(0);
|
||||||
|
|
||||||
|
// 获取可渲染数量
|
||||||
|
const setVisibleNumber = () => {
|
||||||
|
const width = document.body.getBoundingClientRect().width-600;
|
||||||
|
visibleNumber.value = Math.floor(width / 110);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组件的生命周期钩子
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('resize', setVisibleNumber);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 使用计算属性来过滤符合条件的路由
|
||||||
|
const filteredRoutes = computed(() => {
|
||||||
|
return unref(tabRouters).filter((_, index) => index >= unref(visibleNumber));
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => routers.value,
|
() => routers.value,
|
||||||
(routers: AppRouteRecordRaw[]) => {
|
(routers: AppRouteRecordRaw[]) => {
|
||||||
@ -153,51 +169,82 @@ export default defineComponent({
|
|||||||
>
|
>
|
||||||
<ElScrollbar class="!h-[calc(100%-var(--tab-menu-collapse-height)-1px)]">
|
<ElScrollbar class="!h-[calc(100%-var(--tab-menu-collapse-height)-1px)]">
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
{() => {
|
<div class="flex flex-row">
|
||||||
return unref(tabRouters).map((v) => {
|
{() => {
|
||||||
const item = (
|
return unref(tabRouters).map((v, index) => {
|
||||||
v.meta?.alwaysShow || (v?.children?.length && v?.children?.length > 1)
|
const item = (
|
||||||
? v
|
v.meta?.alwaysShow || (v?.children?.length && v?.children?.length > 1)
|
||||||
: {
|
? v
|
||||||
...(v?.children && v?.children[0]),
|
: {
|
||||||
path: pathResolve(v.path, (v?.children && v?.children[0])?.path as string)
|
...(v?.children && v?.children[0]),
|
||||||
}
|
path: pathResolve(v.path, (v?.children && v?.children[0])?.path as string)
|
||||||
) as AppRouteRecordRaw
|
}
|
||||||
return (
|
) as AppRouteRecordRaw
|
||||||
<div
|
return (index < unref(visibleNumber) &&
|
||||||
class={[
|
<div
|
||||||
`${prefixCls}__item`,
|
class={[
|
||||||
'h-[100%] text-center text-14px relative cursor-pointer flex-grow pl-15px pr-15px',
|
`${prefixCls}__item`,
|
||||||
'whitespace-nowrap overflow-hidden',
|
'h-[100%] text-center text-14px relative cursor-pointer flex-grow pl-15px pr-15px',
|
||||||
]}
|
'whitespace-nowrap overflow-hidden',
|
||||||
style={['color: var(--top-header-text-color)', 'height: 50px']}
|
]}
|
||||||
onClick={() => {
|
style={['color: var(--top-header-text-color)', 'height: 50px']}
|
||||||
tabClick(item)
|
onClick={() => {
|
||||||
}}
|
tabClick(item)
|
||||||
>
|
}}
|
||||||
<div class="flex items-center justify-center">
|
>
|
||||||
<Icon class="mb-1px icon-class"
|
<div class="flex items-center justify-center">
|
||||||
icon={item?.meta?.icon}
|
<Icon class="mb-1px"
|
||||||
/>
|
icon={item?.meta?.icon}
|
||||||
<p class="mr-3px mt-13px break-words px-2px "
|
/>
|
||||||
>{t(item.meta?.title)}</p>
|
<p class="mr-3px mt-13px break-words px-2px "
|
||||||
<span
|
>{t(item.meta?.title)}</p>
|
||||||
class={{'is-active': isActive(v.path)}}
|
<span
|
||||||
style={['height: 3px','width: 100%','position: absolute','bottom: 1px']}
|
class={{'is-active': isActive(v.path)}}
|
||||||
/>
|
style={['height: 3px','width: 100%','position: absolute','bottom: 1px']}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)
|
||||||
)
|
})
|
||||||
})
|
}}
|
||||||
}}
|
</div>
|
||||||
|
<div class="flex flex-row">
|
||||||
|
{filteredRoutes.value.length > 0 && (
|
||||||
|
<ElMenu
|
||||||
|
mode="horizontal"
|
||||||
|
style={['height: 48px']}
|
||||||
|
backgroundColor="var(--top-header-bg-color)"
|
||||||
|
textColor="var(--top-header-text-color)"
|
||||||
|
>
|
||||||
|
{() => {
|
||||||
|
return unref(tabRouters).map((v, index) => {
|
||||||
|
const item = (
|
||||||
|
v.meta?.alwaysShow || (v?.children?.length && v?.children?.length > 1)
|
||||||
|
? v
|
||||||
|
: {
|
||||||
|
...(v?.children && v?.children[0]),
|
||||||
|
path: pathResolve(v.path, (v?.children && v?.children[0])?.path as string)
|
||||||
|
}
|
||||||
|
) as AppRouteRecordRaw
|
||||||
|
return (index >= unref(visibleNumber) &&
|
||||||
|
<ElMenuItem
|
||||||
|
index={`menu-item-${index}`}
|
||||||
|
onClick={() => tabClick(item)}
|
||||||
|
>
|
||||||
|
{t(item.meta?.title)}
|
||||||
|
</ElMenuItem>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</ElMenu>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ElScrollbar>
|
</ElScrollbar>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// {!unref(showTitle) ? undefined : (
|
|
||||||
// )}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -196,7 +196,19 @@ const updateForm = async () => {
|
|||||||
// formLoading.value = false
|
// formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defineExpose({updateForm})
|
const message = useMessage() // 消息弹窗
|
||||||
|
const updateNumber = async (date) => {
|
||||||
|
const numberDate = await FwglApi.getFwgl(date.id)
|
||||||
|
const data = numberDate as unknown as FwglVO
|
||||||
|
if (!data.fwglBh) {
|
||||||
|
data.fwglBh = date.value
|
||||||
|
await FwglApi.updateFwgl(data)
|
||||||
|
message.success("操作成功")
|
||||||
|
} else {
|
||||||
|
message.error("文号已存在")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({updateForm,updateNumber})
|
||||||
|
|
||||||
const itemControl = async () => {
|
const itemControl = async () => {
|
||||||
// console.log(userId,"userId")
|
// console.log(userId,"userId")
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="发文文号" prop="fwglBh">
|
<el-form-item label="发文文号" prop="fwglBh">
|
||||||
<el-input v-model="formData.fwglBh" placeholder="请输入发文文号" />
|
<el-input v-model="formData.fwglBh" placeholder="审批中分配" disabled/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -853,14 +853,8 @@ const getNumberByType = async ()=> {
|
|||||||
if (data.total == 0) {
|
if (data.total == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//判断条数,如果只有一条就和流水号一样直接处理
|
// 两条以上数据,给用户挑选,然后处理
|
||||||
if (data.total == 1 ) {
|
ListNumber.value = data.list;
|
||||||
listNumbers.value = data.list[0]
|
|
||||||
await changeNumbers();
|
|
||||||
} else {
|
|
||||||
// 两条以上数据,给用户挑选,然后处理
|
|
||||||
ListNumber.value = data.list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取旧数据后对比数据后更新
|
// 获取旧数据后对比数据后更新
|
||||||
|
Loading…
Reference in New Issue
Block a user