|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
<script setup lang="ts">
|
|
|
import router from '@/router'
|
|
|
import { ElMessage, ElMessageBox, type DialogProps } from 'element-plus'
|
|
|
-import type { AdvancedForm, BasicForm, ICRUD } from '@/types/form'
|
|
|
+import type { AdvancedForm, BasicForm, ICRUD, formSlot } from '@/types/form'
|
|
|
import type { VXEComponent, VxeToolbarProps, VxeToolbarEventProps } from 'vxe-table'
|
|
|
|
|
|
interface CustomTable {
|
|
|
@@ -194,6 +194,15 @@ const dialogVisible = ref(false)
|
|
|
const handleFormSuccess = () => {
|
|
|
getTableData()
|
|
|
}
|
|
|
+
|
|
|
+const formSlots = ref<formSlot[]>([])
|
|
|
+if (props.formConfig.advanced) {
|
|
|
+ props.formConfig.formItems.forEach((item: any) => {
|
|
|
+ item.group.forEach((subItem: any) => Array.prototype.push.apply(formSlots.value, subItem.slots))
|
|
|
+ })
|
|
|
+} else {
|
|
|
+ props.formConfig.formItems.forEach((item: any) => Array.prototype.push.apply(formSlots.value, item.slots))
|
|
|
+}
|
|
|
// ============== 表单部分结束 ===============
|
|
|
|
|
|
defineExpose({
|
|
|
@@ -209,7 +218,11 @@ defineExpose({
|
|
|
<el-card class="mb-4" shadow="never" v-if="searchList.length || slots.query">
|
|
|
<el-form :inline="true">
|
|
|
<el-form-item :label="item.label" v-for="(item, index) in searchList" :key="index">
|
|
|
- <form-comp :item="item" v-model="query[item.name]"></form-comp>
|
|
|
+ <form-comp :item="item" v-model="query[item.name]">
|
|
|
+ <template #[slot.alias] v-for="slot in item.slots" :key="slot.alias">
|
|
|
+ <slot :name="slot.alias"></slot>
|
|
|
+ </template>
|
|
|
+ </form-comp>
|
|
|
</el-form-item>
|
|
|
<slot name="query" :query="query"></slot>
|
|
|
<el-form-item>
|
|
|
@@ -288,7 +301,11 @@ defineExpose({
|
|
|
:update="crud.update"
|
|
|
@success="handleFormSuccess"
|
|
|
v-if="dialogVisible"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template #[slot.alias] v-for="slot in formSlots" :key="slot.alias">
|
|
|
+ <slot :name="slot.alias"></slot>
|
|
|
+ </template>
|
|
|
+ </dialog-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|