设计需求、测试项、用例的上级hover显示
This commit is contained in:
@@ -17,7 +17,14 @@
|
||||
>
|
||||
<template #title>{{ actionTitle }}</template>
|
||||
<a-spin :loading="dataLoading" tip="加载中..." class="w-full">
|
||||
<ma-form v-model="form" :columns="formColumns" :options="formOptions" ref="maFormRef">
|
||||
<!-- 修改源码parentKey -->
|
||||
<ma-form
|
||||
v-model="form"
|
||||
:columns="formColumns"
|
||||
:parent-key="props.parentKey"
|
||||
:options="formOptions"
|
||||
ref="maFormRef"
|
||||
>
|
||||
<template v-for="slot in Object.keys($slots)" #[slot]="component">
|
||||
<slot :name="slot" v-bind="component" />
|
||||
</template>
|
||||
@@ -35,6 +42,11 @@ import { useRouter } from "vue-router"
|
||||
import tool from "@/utils/tool"
|
||||
import { useFormStore } from "@/store/index"
|
||||
|
||||
// 2025年5月14日新增
|
||||
const props = defineProps({
|
||||
parentKey: { type: String, default: "" }
|
||||
})
|
||||
|
||||
const formStore = useFormStore()
|
||||
const router = useRouter()
|
||||
const formOptions = ref({ showButtons: false })
|
||||
|
||||
@@ -257,7 +257,8 @@
|
||||
|
||||
<ma-setting ref="crudSettingRef" @onChangeSearchHide="initSearchColumns()" @onChangeColumnHide="changeColumn" />
|
||||
<!-- 修改源码:透传ma-crud属性给ma-form -->
|
||||
<ma-form ref="crudFormRef" @success="requestSuccess" v-bind="$attrs">
|
||||
<!-- 修改源码:传递parentKey值 -->
|
||||
<ma-form ref="crudFormRef" @success="requestSuccess" v-bind="$attrs" :parent-key="props.parentKey">
|
||||
<template v-for="(slot, index) in Object.keys($slots)" #[slot]="component" :key="index">
|
||||
<slot :name="slot" v-bind="component" />
|
||||
</template>
|
||||
@@ -308,7 +309,9 @@ const props = defineProps({
|
||||
options: { type: Object, default: {} },
|
||||
crud: { type: Object, default: {} },
|
||||
// 字段列设置
|
||||
columns: { type: Array, default: [] }
|
||||
columns: { type: Array, default: [] },
|
||||
// ~~~2025年5月14日新增透传给ma-form字段
|
||||
parentKey: { type: String, default: "" }
|
||||
})
|
||||
|
||||
const loading = ref(true)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-button-group shape="round" size="mini">
|
||||
<a-button type="primary" @click="moveUp(index)">
|
||||
<a-button type="primary" @click="moveUp(index)">
|
||||
<icon-arrow-rise />
|
||||
</a-button>
|
||||
<a-button type="primary" @click="moveDown(index)">
|
||||
|
||||
@@ -63,12 +63,16 @@
|
||||
</div>
|
||||
</slot>
|
||||
</a-form>
|
||||
<!-- 修改源码:判断是否传入parentKey -->
|
||||
<template v-if="parentKey">
|
||||
<ParentPreview :parent-key="parentKey"></ParentPreview>
|
||||
</template>
|
||||
</a-spin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, provide, onMounted, nextTick, getCurrentInstance } from "vue"
|
||||
import { ref, watch, provide, onMounted, nextTick, getCurrentInstance, inject, computed } from "vue"
|
||||
import { isNil, set, get, cloneDeep } from "lodash-es"
|
||||
import defaultOptions from "./js/defaultOptions.js"
|
||||
import {
|
||||
@@ -94,11 +98,32 @@ const dictList = ref({})
|
||||
const cascaderList = ref([])
|
||||
const form = ref({})
|
||||
|
||||
// custom start
|
||||
// 2025年5月14日新增功能hover查看上级节点
|
||||
import ParentPreview from "@/views/project/ParentPreview/index.vue"
|
||||
// 判断是否有
|
||||
const formKey = computed(() => {
|
||||
// 去掉双击被测件:即key.split("").length > 1
|
||||
if (form.value.key && form.value.key.split("-").length > 2) {
|
||||
// 如果存在则取前面的
|
||||
return form.value.key.slice(0, -2)
|
||||
}
|
||||
return ""
|
||||
})
|
||||
|
||||
const parentKey = computed(() => {
|
||||
return props.parentKey || formKey.value || ""
|
||||
})
|
||||
// custom end
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: Object, default: {} },
|
||||
columns: { type: Array },
|
||||
options: { type: Object, default: {} }
|
||||
options: { type: Object, default: {} },
|
||||
// 2025年5月14日新增属性-非必须,后面根据非必须判断
|
||||
parentKey: { type: String, default: "" }
|
||||
})
|
||||
|
||||
const emit = defineEmits(["submit", "update:modelValue"])
|
||||
|
||||
watch(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:title="props.title"
|
||||
:layout="props.layout"
|
||||
:bordered="props.bordered"
|
||||
table-layout="fixed"
|
||||
:table-layout="props.tableLayout"
|
||||
:size="props.size"
|
||||
:label-style="props.labelStyle"
|
||||
:value-style="props.valueStyle"
|
||||
@@ -105,7 +105,9 @@ const props = defineProps({
|
||||
},
|
||||
size: {
|
||||
default: "large"
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
tableLayout: { type: String, default: "fixed" }
|
||||
})
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user