mirror of
https://github.com/opbnq-q/nto-cli.git
synced 2025-12-06 19:30:33 +07:00
fix: scheme
This commit is contained in:
@@ -5,6 +5,8 @@ import { getDefaultValues } from '../utils/structs/defaults.util'
|
|||||||
import Service from './{{.LowerName}}.service.ts'
|
import Service from './{{.LowerName}}.service.ts'
|
||||||
import type { Scheme } from '../types/scheme.type'
|
import type { Scheme } from '../types/scheme.type'
|
||||||
import { {{.StructName}} } from '{{.GolangServicesPath}}'
|
import { {{.StructName}} } from '{{.GolangServicesPath}}'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import type { Validate } from '../types/validate.type'
|
||||||
{{range .Dependencies}}
|
{{range .Dependencies}}
|
||||||
import {{.ImportName}} from '../{{.LowerName}}/{{.LowerName}}.service.ts'
|
import {{.ImportName}} from '../{{.LowerName}}/{{.LowerName}}.service.ts'
|
||||||
const {{.ServiceName}} = new {{.ImportName}}
|
const {{.ServiceName}} = new {{.ImportName}}
|
||||||
@@ -12,10 +14,18 @@ const {{.ServiceName}} = new {{.ImportName}}
|
|||||||
|
|
||||||
const service = new Service
|
const service = new Service
|
||||||
|
|
||||||
onMounted(async () => {
|
const items = ref<{{ .StructName }}[]>([])
|
||||||
|
|
||||||
|
const load = async () => {
|
||||||
{{range .Dependencies}}
|
{{range .Dependencies}}
|
||||||
(scheme as any).{{.FieldName}}.type!.nested!.values = await {{.ServiceName}}.readAll()
|
(scheme as any).{{.FieldName}}.type!.nested!.values = await {{.ServiceName}}.readAll();
|
||||||
{{end}}
|
{{end}}
|
||||||
|
items.value = await service.readAll();
|
||||||
|
return items.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
load()
|
||||||
})
|
})
|
||||||
|
|
||||||
const scheme: Scheme<{{.StructName}}> = reactive({
|
const scheme: Scheme<{{.StructName}}> = reactive({
|
||||||
@@ -27,10 +37,16 @@ const scheme: Scheme<{{.StructName}}> = reactive({
|
|||||||
|
|
||||||
const getDefaults = () => getDefaultValues(scheme)
|
const getDefaults = () => getDefaultValues(scheme)
|
||||||
|
|
||||||
|
const validate: Validate<{{.StructName}}> = (entity) => {
|
||||||
|
return {
|
||||||
|
status: 'success'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="w-screen h-screen">
|
<main class="w-screen h-screen">
|
||||||
<Table :scheme :service :getDefaults></Table>
|
<Table :scheme :service :get-defaults :load :items :validate></Table>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user