多项功能改进
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<!-- 修改源码:添加mask-closable属性 -->
|
||||
<!-- 修改源码:添加on-before-cancel属性 -->
|
||||
<!-- 修改源码:如果为componentName为a-modal则标题吸顶 -->
|
||||
<component
|
||||
:is="componentName"
|
||||
v-model:visible="dataVisible"
|
||||
@@ -15,7 +16,9 @@
|
||||
:fullscreen="options.formOption.isFull || false"
|
||||
unmount-on-close
|
||||
>
|
||||
<template #title>{{ actionTitle }}</template>
|
||||
<template #title>
|
||||
{{ actionTitle }}
|
||||
</template>
|
||||
<a-spin :loading="dataLoading" tip="加载中..." class="w-full">
|
||||
<!-- 修改源码parentKey -->
|
||||
<ma-form
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<a-collapse-item
|
||||
v-for="(item, itemIndex) in formModel[props.component.dataIndex]"
|
||||
:key="itemIndex"
|
||||
:header="`${props.component.title} ${itemIndex + 1}项`"
|
||||
:header="`${props.component.title} 第${itemIndex + 1}项 ${item.subName ? item.subName : ''}`"
|
||||
>
|
||||
<template #extra>
|
||||
<a-space>
|
||||
@@ -165,6 +165,15 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 修改源码:切换显示形态 -->
|
||||
<a-popover>
|
||||
<template #title>切换{{ props.component.type === "group" ? "表格" : "聚合" }}显示</template>
|
||||
<div class="sticky-container" @click="swapTableOrGroupDisplay">
|
||||
<div class="sticky-button">
|
||||
<icon-swap />
|
||||
</div>
|
||||
</div>
|
||||
</a-popover>
|
||||
</a-form-item>
|
||||
</template>
|
||||
|
||||
@@ -183,6 +192,24 @@ const formModel = inject("formModel")
|
||||
const dictList = inject("dictList")
|
||||
const getColumnService = inject("getColumnService")
|
||||
const columns = inject("columns")
|
||||
|
||||
// ~~~~修改源码-start
|
||||
const emit = defineEmits(["swichTableAndGroup"])
|
||||
const swapTableOrGroupDisplay = () => {
|
||||
props.component.type = props.component.type === "group" ? "table" : "group"
|
||||
emit("swichTableAndGroup", props.component.type)
|
||||
}
|
||||
watch(
|
||||
() => props.component.type,
|
||||
(newVal) => {
|
||||
if (newVal === "group") {
|
||||
formList.forEach((item) => (item.hideLabel = false))
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
// ~~~~修改源码-end
|
||||
|
||||
const rv = async (ev, value = undefined) =>
|
||||
await runEvent(props.component, ev, { formModel, getColumnService, columns }, value)
|
||||
|
||||
@@ -299,4 +326,36 @@ onMounted(async () => {
|
||||
:deep(.arco-table-cell .arco-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
// 切换按钮-以后单独封装一个组件
|
||||
.sticky-container {
|
||||
position: fixed;
|
||||
right: 80px;
|
||||
top: 35%;
|
||||
z-index: 10000;
|
||||
}
|
||||
.sticky-button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);
|
||||
transition: all 0.1s;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
span {
|
||||
white-space: nowrap;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.sticky-button:hover {
|
||||
transition: all 0.1s;
|
||||
border: 1px solid rgb(64, 128, 255);
|
||||
color: rgb(64, 128, 255);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
:disabled="options?.disabled"
|
||||
:rules="options?.rules"
|
||||
@submit="formSubmit"
|
||||
:key="componentKey"
|
||||
>
|
||||
<slot name="formContent">
|
||||
<template v-for="(component, componentIndex) in columns" :key="componentIndex">
|
||||
@@ -25,6 +26,7 @@
|
||||
:is="getComponentName(component?.formType ?? 'input')"
|
||||
:component="component"
|
||||
:ref="setDialogRef"
|
||||
@swichTableAndGroup="handleChangeDisplay"
|
||||
>
|
||||
<template v-for="slot in Object.keys($slots)" #[slot]="component">
|
||||
<slot :name="slot" v-bind="component" />
|
||||
@@ -98,7 +100,20 @@ const dictList = ref({})
|
||||
const cascaderList = ref([])
|
||||
const form = ref({})
|
||||
|
||||
// custom start
|
||||
// ~~~custom start - 新增功能利用key强制更新form表单组件
|
||||
const componentKey = ref(0)
|
||||
const updateKey = () => {
|
||||
componentKey.value += 1
|
||||
if (componentKey.value > 20000) {
|
||||
componentKey.value = 0
|
||||
}
|
||||
}
|
||||
const handleChangeDisplay = (type) => {
|
||||
updateKey()
|
||||
}
|
||||
// ~~~custom end
|
||||
|
||||
// ~~~~custom start
|
||||
// 2025年5月14日新增功能hover查看上级节点
|
||||
import ParentPreview from "@/views/project/ParentPreview/index.vue"
|
||||
// 判断是否有
|
||||
@@ -114,7 +129,7 @@ const formKey = computed(() => {
|
||||
const parentKey = computed(() => {
|
||||
return props.parentKey || formKey.value || ""
|
||||
})
|
||||
// custom end
|
||||
// ~~~~custom end
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: Object, default: {} },
|
||||
|
||||
Reference in New Issue
Block a user