From c226243c409d8b8790eb832f5d4049a324908077 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Fri, 14 Jul 2023 17:30:49 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E6=9C=9F?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE=E5=92=8C=E9=80=9A=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vanilla/components/form/form-input.js | 37 ++- code/WebApp/vanilla/components/form/index.js | 10 +- code/WebApp/vanilla/components/list/index.js | 237 ++++++++++++------ .../vanilla/models/centralized-control.js | 136 ++++++++++ code/WebApp/vanilla/models/code-setting.js | 14 +- code/WebApp/vanilla/request/index.js | 8 +- code/WebApp/vanilla/router/routes.js | 93 +++++++ .../views/base-data/centralized-control.js | 27 ++ .../vanilla/views/base-data/code-setting.js | 13 - code/WebApp/vanilla/views/login.js | 4 +- docs/ui.rp | Bin 521441 -> 537323 bytes 11 files changed, 475 insertions(+), 104 deletions(-) create mode 100644 code/WebApp/vanilla/models/centralized-control.js create mode 100644 code/WebApp/vanilla/views/base-data/centralized-control.js diff --git a/code/WebApp/vanilla/components/form/form-input.js b/code/WebApp/vanilla/components/form/form-input.js index 87d16b3d..f4b0e543 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 +98,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..b8b7247f 100644 --- a/code/WebApp/vanilla/components/list/index.js +++ b/code/WebApp/vanilla/components/list/index.js @@ -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" - /> + > + + @@ -231,23 +237,26 @@ export default { - + {{$t('筛选')}} @@ -246,7 +246,7 @@ export default { - + @@ -269,30 +269,30 @@ export default { - - - - - - -