diff --git a/code/WebApp/vanilla/components/form/form-input.js b/code/WebApp/vanilla/components/form/form-input.js index 87d16b3d..24a7112c 100644 --- a/code/WebApp/vanilla/components/form/form-input.js +++ b/code/WebApp/vanilla/components/form/form-input.js @@ -2,14 +2,16 @@ import html from "html"; import { ref, reactive, watch, onMounted } from "vue"; import { dayjs } from "element-plus"; import request, { post } from "../../request/index.js"; +import { importFunction } from "../../utils/index.js"; export default { template: html` + - `, @@ -87,6 +100,22 @@ export default { const selectProps = ref({}); const selectValues = ref([]); const options = ref([]); + //watch + + watch( + () => model[props.prop], + async (value) => { + if (props.schema.watch) { + console.log(value); + if (props.schema.watch?.constructor === String) { + props.schema.watch = await importFunction(props.schema.watch); + } + if (props.schema.watch?.constructor === Function) { + props.schema.watch(model, value); + } + } + } + ); onMounted(async () => { if (props.schema.options) { options.value = props.schema.options; diff --git a/code/WebApp/vanilla/components/form/index.js b/code/WebApp/vanilla/components/form/index.js index df07298f..9e876e63 100644 --- a/code/WebApp/vanilla/components/form/index.js +++ b/code/WebApp/vanilla/components/form/index.js @@ -5,7 +5,7 @@ export default { components: { AppFormItem: defineAsyncComponent(() => import("./form-item.js")) }, name: "AppForm", template: html`
- + - + - $t('confirm') + + $t('confirm') +
`, - props: ["modelValue", "schema", "action", "hideButton", "isQueryForm", "mode"], + props: ["modelValue", "inline", "schema", "action", "hideButton", "isQueryForm", "mode"], emits: ["update:modelValue", "submit"], setup(props, context) { // init diff --git a/code/WebApp/vanilla/components/list/index.js b/code/WebApp/vanilla/components/list/index.js index 802dee6b..a312d55c 100644 --- a/code/WebApp/vanilla/components/list/index.js +++ b/code/WebApp/vanilla/components/list/index.js @@ -1,5 +1,5 @@ import html, { getProp } from "html"; -import request, { get, post } from "../../request/index.js"; +import request, { get, getUrl, post } from "../../request/index.js"; import { defineAsyncComponent, ref, reactive, onMounted } from "vue"; import { useRoute, useRouter } from "vue-router"; import { useI18n } from "vue-i18n"; @@ -14,6 +14,7 @@ export default { name: "AppList", components: { AppForm: defineAsyncComponent(() => import("../form/index.js")), + AppFormInput: defineAsyncComponent(() => import("../../components/form/form-input.js")), SvgIcon: defineAsyncComponent(() => import("../../components/icon/index.js")), AppFormInput: defineAsyncComponent(() => import("../form/form-input.js")), VueOfficeExcel, @@ -26,13 +27,18 @@ export default { inline mode="query" label-position="left" - :schema="querySchema" + :schema="config.query.schema" v-model="queryModel" @submit="load" :hideButton="true" :isQueryForm="true" - v-if="querySchema" - /> + > + + @@ -48,7 +54,7 @@ export default { {{item.meta.title}} - + {{$t('筛选')}} @@ -231,23 +237,26 @@ export default {