123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <script lang="ts">
- export default { name: '{{pascalCase name}}Form' };
- </script>
- <script setup lang="ts">
- import { ref, PropType } from 'vue';
- import { query{{pascalCase name}}, create{{pascalCase name}}, update{{pascalCase name}}, delete{{pascalCase name}} } from '@/api/{{kebabCase path}}';
- import DialogForm from '@/components/DialogForm.vue';
- import LabelTip from '@/components/LabelTip.vue';
- defineProps({ modelValue: { type: Boolean, required: true }, beanId: { type: Number, default: null }, beanIds: { type: Array as PropType<number[]>, required: true } });
- defineEmits({ 'update:modelValue': null, finished: null });
- const focus = ref();
- const values = ref<Record<string, any>>({});
- </script>
- <template>
- <dialog-form
- v-model:values="values"
- :name="$t('menu.{{camelCase path}}.{{camelCase name}}')"
- :query-bean="query{{pascalCase name}}"
- :create-bean="create{{pascalCase name}}"
- :update-bean="update{{pascalCase name}}"
- :delete-bean="delete{{pascalCase name}}"
- :bean-id="beanId"
- :bean-ids="beanIds"
- :focus="focus"
- :init-values="(): any => ({})"
- :to-values="(bean) => ({ ...bean })"
- :model-value="modelValue"
- perms="{{camelCase name}}"
- @update:model-value="(event) => $emit('update:modelValue', event)"
- @finished="() => $emit('finished')"
- >
- <template #default="{ bean }">
- <el-form-item prop="name" :rules="{ required: true, message: () => $t('v.required') }">
- <template #label><label-tip message="{{camelCase name}}.name" /></template>
- <el-input ref="focus" v-model="values.name" maxlength="50"></el-input>
- </el-form-item>
- </template>
- </dialog-form>
- </template>
|