|
|
@@ -3,7 +3,6 @@ import { ElMessage, ElMessageBox, type FormProps } from 'element-plus'
|
|
|
import type { PropType } from 'vue'
|
|
|
import type { AdvancedForm, BasicForm, BasicFormItem } from '@/types/form'
|
|
|
import router from '@/router'
|
|
|
-import type { RouteLocationNormalized } from 'vue-router'
|
|
|
|
|
|
interface CRUD {
|
|
|
create: Function
|
|
|
@@ -33,15 +32,21 @@ const props = defineProps({
|
|
|
|
|
|
// ============== 查询部分开始 ===============
|
|
|
const query = ref<any>({})
|
|
|
-// const searchList = computed(() =>
|
|
|
-// props.form.formItems.filter((item: any) => {
|
|
|
-// if (item.group) {
|
|
|
-// } else {
|
|
|
-// item.search
|
|
|
-// }
|
|
|
-// })
|
|
|
-// )
|
|
|
const searchList = ref<any>([])
|
|
|
+watch(
|
|
|
+ () => props.form.formItems,
|
|
|
+ val => {
|
|
|
+ val.forEach((item: any) => {
|
|
|
+ if (item.group) {
|
|
|
+ searchList.value = searchList.value.concat(item.group.filter((item: any) => item.search))
|
|
|
+ } else {
|
|
|
+ item.search && searchList.value.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(searchList.value)
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+)
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
curPage.value = 1
|
|
|
@@ -140,15 +145,7 @@ const dialogVisible = ref(false)
|
|
|
<el-card class="mb-4" shadow="never">
|
|
|
<el-form :inline="true">
|
|
|
<el-form-item :label="item.label" v-for="item in searchList">
|
|
|
- <component
|
|
|
- :is="'el-' + item.type"
|
|
|
- v-model="query[item.name]"
|
|
|
- :placeholder="item.placeholder || placeholder(item)"
|
|
|
- >
|
|
|
- <template v-if="item.type === 'radio-group'">
|
|
|
- <el-radio :label="option.label" v-for="option in item.options">{{ option.value }}</el-radio>
|
|
|
- </template>
|
|
|
- </component>
|
|
|
+ <form-comp :item="item" :formData="query"></form-comp>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="handleQuery">查询</el-button>
|