Compare commits

..

No commits in common. "638b13ac3e2cace8744f7b498a0dd79e008bc8b9" and "36661d1420f9ac3009cdd79c3e0e3668d742b34b" have entirely different histories.

4 changed files with 54 additions and 107 deletions

View File

@ -2,8 +2,9 @@
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, ElMenu, ElMenuItem } from 'element-plus' import { ElScrollbar } 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'
@ -33,6 +34,10 @@ 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]}`
@ -52,30 +57,9 @@ 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[]) => {
@ -169,82 +153,51 @@ 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) => {
return unref(tabRouters).map((v, index) => { const item = (
const item = ( v.meta?.alwaysShow || (v?.children?.length && v?.children?.length > 1)
v.meta?.alwaysShow || (v?.children?.length && v?.children?.length > 1) ? v
? v : {
: { ...(v?.children && v?.children[0]),
...(v?.children && v?.children[0]), path: pathResolve(v.path, (v?.children && v?.children[0])?.path as string)
path: pathResolve(v.path, (v?.children && v?.children[0])?.path as string) }
} ) as AppRouteRecordRaw
) as AppRouteRecordRaw return (
return (index < unref(visibleNumber) && <div
<div class={[
class={[ `${prefixCls}__item`,
`${prefixCls}__item`, 'h-[100%] text-center text-14px relative cursor-pointer flex-grow pl-15px pr-15px',
'h-[100%] text-center text-14px relative cursor-pointer flex-grow pl-15px pr-15px', 'whitespace-nowrap overflow-hidden',
'whitespace-nowrap overflow-hidden', ]}
]} style={['color: var(--top-header-text-color)', 'height: 50px']}
style={['color: var(--top-header-text-color)', 'height: 50px']} onClick={() => {
onClick={() => { tabClick(item)
tabClick(item) }}
}} >
> <div class="flex items-center justify-center">
<div class="flex items-center justify-center"> <Icon class="mb-1px icon-class"
<Icon class="mb-1px" icon={item?.meta?.icon}
icon={item?.meta?.icon} />
/> <p class="mr-3px mt-13px break-words px-2px "
<p class="mr-3px mt-13px break-words px-2px " >{t(item.meta?.title)}</p>
>{t(item.meta?.title)}</p> <span
<span class={{'is-active': isActive(v.path)}}
class={{'is-active': isActive(v.path)}} style={['height: 3px','width: 100%','position: absolute','bottom: 1px']}
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>

View File

@ -196,19 +196,7 @@ const updateForm = async () => {
// formLoading.value = false // formLoading.value = false
} }
} }
const message = useMessage() // defineExpose({updateForm})
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")

View File

@ -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="审批中分配" disabled/> <el-input v-model="formData.fwglBh" placeholder="请输入发文文号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -853,8 +853,14 @@ const getNumberByType = async ()=> {
if (data.total == 0) { if (data.total == 0) {
return; return;
} }
// ,, //,
ListNumber.value = data.list; if (data.total == 1 ) {
listNumbers.value = data.list[0]
await changeNumbers();
} else {
// ,,
ListNumber.value = data.list;
}
} }
// //