This commit is contained in:
xiaojunnuo
2024-11-25 23:48:04 +08:00
parent c6fff4950d
commit 92c6c45e77
6 changed files with 26 additions and 6 deletions
@@ -12,6 +12,7 @@
<script setup lang="ts">
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { ref, inject } from "vue";
import { Form } from "ant-design-vue";
defineOptions({
name: "ApiTest"
@@ -19,7 +20,7 @@ defineOptions({
const getScope: any = inject("get:scope");
const getPluginType: any = inject("get:plugin:type");
const formItemContext = Form.useInjectFormItemContext();
const props = defineProps<{} & ComponentPropsType>();
const emit = defineEmits<{
@@ -34,13 +35,14 @@ const doTest = async () => {
return;
}
formItemContext.onFieldChange();
const { form } = getScope();
const pluginType = getPluginType();
message.value = "";
hasError.value = false;
loading.value = true;
debugger;
try {
const res = await doRequest(
{
@@ -47,6 +47,13 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
//eval
useReference(column);
if (column.required) {
if (!column.rules) {
column.rules = [];
}
column.rules.push({ required: true, message: "此项必填" });
}
//设置默认值
if (column.value != null && get(form, key) == null) {
set(form, key, column.value);
@@ -38,6 +38,13 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
//eval
useReference(column);
if (column.required) {
if (!column.rules) {
column.rules = [];
}
column.rules.push({ required: true, message: "此项必填" });
}
//设置默认值
if (column.value != null && get(form, key) == null) {
set(form, key, column.value);