| | |
| | | <script setup name="Demo" lang="ts"> |
| | | import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo'; |
| | | import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types'; |
| | | import { ComponentInternalInstance } from 'vue'; |
| | | import { ElForm } from 'element-plus'; |
| | | |
| | | const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
| | | |
| | |
| | | const multiple = ref(true); |
| | | const total = ref(0); |
| | | |
| | | const queryFormRef = ref(ElForm); |
| | | const demoFormRef = ref(ElForm); |
| | | const queryFormRef = ref<ElFormInstance>(); |
| | | const demoFormRef = ref<ElFormInstance>(); |
| | | |
| | | const dialog = reactive<DialogOption>({ |
| | | visible: false, |
| | |
| | | /** 表单重置 */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | demoFormRef.value.resetFields(); |
| | | demoFormRef.value?.resetFields(); |
| | | } |
| | | |
| | | /** 搜索按钮操作 */ |
| | |
| | | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields(); |
| | | queryFormRef.value?.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | |
| | |
| | | |
| | | /** 提交按钮 */ |
| | | const submitForm = () => { |
| | | demoFormRef.value.validate(async (valid: boolean) => { |
| | | demoFormRef.value?.validate(async (valid: boolean) => { |
| | | if (valid) { |
| | | buttonLoading.value = true; |
| | | if (form.value.id) { |