diff --git a/code/.gitignore b/code/.gitignore index 07d8289e..70a3f6dd 100644 --- a/code/.gitignore +++ b/code/.gitignore @@ -26,8 +26,8 @@ dist/ #be .vs/ -bin/ -obj/ +bin +obj *.suo *.user *.db diff --git a/code/WebApp/vanilla/app.js b/code/WebApp/vanilla/app.js index 9f35eb2c..34b69c72 100644 --- a/code/WebApp/vanilla/app.js +++ b/code/WebApp/vanilla/app.js @@ -6,12 +6,11 @@ import { Suspense, reactive, onMounted } from "vue"; export default { components: { ElConfigProvider, Suspense }, - template: html` + template: html` - - `, + `, setup() { const localeMap = reactive( new Map([ diff --git a/code/WebApp/vanilla/components/form/form-input.js b/code/WebApp/vanilla/components/form/form-input.js index a99cc6c0..6d133fc6 100644 --- a/code/WebApp/vanilla/components/form/form-input.js +++ b/code/WebApp/vanilla/components/form/form-input.js @@ -1,7 +1,7 @@ import html from "html"; -import { ref, reactive, watch } from "vue"; +import { ref, reactive, watch, onMounted } from "vue"; import { dayjs } from "element-plus"; -import { post } from "../../request/index.js"; +import request, { post } from "../../request/index.js"; export default { template: html` @@ -55,28 +55,25 @@ export default { v-model="model[prop]" type="password" show-password - v-if="schema.format==='password'" + v-if="schema.input==='password'" /> `, - props: ["modelValue", "schema", "prop", "isReadOnly"], + props: ["modelValue", "schema", "prop", "isReadOnly", "mode"], emit: ["update:modelValue"], - async setup(props, context) { + setup(props, context) { const model = reactive(props.modelValue); watch(model, (value) => { context.emit("update:modelValue", value); }); /*start*/ const getDisabled = () => { - if (props.isReadOnly && props.isReadOnly === true) { + if (props.mode==='details') { return true; } - if (props.schema.displayOnly) { - return true; - } - if (props.mode === "update" && props.schema.addOnly) { + if (props.mode === "update" && props.schema.readOnly) { return true; } return false; @@ -89,20 +86,22 @@ export default { const selectProps = ref({}); const selectValues = ref([]); const options = ref([]); - if (props.schema.options) { - options.value = props.schema.options; - } else if (props.schema.url) { - try { - const url = `${props.schema.url}`; - const result = await post(url, { queryAll: true, query: { isReadonly: null, isDisabled: null, order: null } }); - options.value = result.data?.items.map((o) => ({ - value: o[props.schema.value], - label: o[props.schema.label], - })); - } catch (error) { - console.log(error); + onMounted(async () => { + if (props.schema.options) { + options.value = props.schema.options; + } else if (props.schema.url) { + try { + const url = `${props.schema.url}`; + const result = await request(url, null, { method: "get" }); + options.value = result.data?.items.map((o) => ({ + value: o[props.schema.value], + label: o[props.schema.label], + })); + } catch (error) { + console.log(error); + } } - } + }); return { model, getDisabled, diff --git a/code/WebApp/vanilla/components/form/form-item.js b/code/WebApp/vanilla/components/form/form-item.js index ae49e013..1616337b 100644 --- a/code/WebApp/vanilla/components/form/form-item.js +++ b/code/WebApp/vanilla/components/form/form-item.js @@ -1,11 +1,13 @@ import html from "html"; import { defineAsyncComponent, ref, reactive, watch } from "vue"; +import { format } from "../../utils/index.js"; +import { messages } from "../../utils/validation.js"; export default { name: "formItem", components: { AppFormInput: defineAsyncComponent(() => import("./form-input.js")) }, template: html` -