vben全局表单样式调整

szh-new
lijingjia 7 months ago
parent bc08b4917a
commit babc225fb3

@ -1,3 +1,8 @@
<!--
* @Description:
* @Author: lijj
* @Date: 2024-04-15 17:08:07
-->
<template> <template>
<span :class="getClass"> <span :class="getClass">
<slot></slot> <slot></slot>
@ -45,9 +50,9 @@
.@{prefix-cls} { .@{prefix-cls} {
position: relative; position: relative;
display: flex; display: flex;
padding-left: 7px;
font-size: 16px; font-size: 16px;
font-weight: 500; font-family: 'PingFang SC';
font-weight: 600;
line-height: 24px; line-height: 24px;
color: @text-color-base; color: @text-color-base;
cursor: pointer; cursor: pointer;

@ -4,9 +4,10 @@
ref="formElRef" ref="formElRef"
:class="getFormClass" :class="getFormClass"
:model="formModel" :model="formModel"
layout="vertical"
@keypress.enter="handleEnterPress" @keypress.enter="handleEnterPress"
> >
<Row v-bind="getRow"> <Row v-bind="getRow" :gutter="15">
<slot name="formHeader"></slot> <slot name="formHeader"></slot>
<template v-for="schema in getSchema" :key="schema.field"> <template v-for="schema in getSchema" :key="schema.field">
<FormItem <FormItem
@ -318,13 +319,20 @@
&-label label::after { &-label label::after {
margin: 0 6px 0 2px; margin: 0 6px 0 2px;
} }
&-label {
padding-bottom: 1px;
}
&-no-colon {
font-size: 12px;
color: #262626;
font-weight: 600;
}
&-with-help { &-with-help {
margin-bottom: 0; margin-bottom: 0;
} }
&:not(.ant-form-item-with-help) { &:not(.ant-form-item-with-help) {
margin-bottom: 20px; margin-bottom: 15px;
} }
&.suffix-item { &.suffix-item {

@ -15,7 +15,6 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<
wrapperCol: globWrapperCol, wrapperCol: globWrapperCol,
layout, layout,
} = unref(propsRef) } = unref(propsRef)
// If labelWidth is set globally, all items setting // If labelWidth is set globally, all items setting
if ((!globalLabelWidth && !labelWidth && !globalLabelCol) || disabledLabelWidth) { if ((!globalLabelWidth && !labelWidth && !globalLabelCol) || disabledLabelWidth) {
labelCol.style = { labelCol.style = {
@ -34,7 +33,8 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<
return { return {
labelCol: { style: { width }, ...col }, labelCol: { style: { width }, ...col },
wrapperCol: { wrapperCol: {
style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` }, // style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` },
style: { width: '100%' },
...wrapCol, ...wrapCol,
}, },
} }

@ -10,7 +10,6 @@ import { getFormSetInfoByModule } from '/@/views/baseinfo/formset/api'
import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api' import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api'
// 引入表格权限信息包含id和name // 引入表格权限信息包含id和name
import { permissionsInfo } from '/@/hooks/web/usePermission' import { permissionsInfo } from '/@/hooks/web/usePermission'
/** /**
* @description: * @description:
* @param {*} updateSchema (vben) * @param {*} updateSchema (vben)

@ -24,19 +24,29 @@ import { useMultipleTabStore } from '/@/store/modules/multipleTab'
export function permissionsInfo() { export function permissionsInfo() {
let permissionId: string = '' let permissionId: string = ''
let permissionName: string = '' let permissionName: string = ''
const fullPath = ref(router.currentRoute.value.fullPath) const fullPath = ref(router.currentRoute.value.path)
usePermissionStore().getWrouteList.forEach((item: Record<any, any>) => { const routerList = treeOptionData(usePermissionStore().getWrouteList)
item.children[0].children?.forEach((row: Record<any, any>) => { routerList.forEach(item => {
if (fullPath.value.indexOf(row.path) != -1) { if (item.path === fullPath.value) {
permissionId = row.id console.log(fullPath.value)
permissionName = row.name permissionId = item.id
console.log(permissionId) permissionName = item.name
} }
})
}) })
return { permissionId, permissionName } return { permissionId, permissionName }
} }
// 递归查找路由中path与当前path完全相同的路由
function treeOptionData(array, result = []) {
array.forEach(item => {
result.push({ name: item.name, id: item.id, path: item.path })
if (item.children && item.children.length) {
treeOptionData(item.children, result)
}
})
return JSON.parse(JSON.stringify(result))
}
// User permissions related operations // User permissions related operations
export function usePermission() { export function usePermission() {
const userStore = useUserStore() const userStore = useUserStore()

Loading…
Cancel
Save