feat: 模板添加接口
parent
2743f21ddf
commit
e36fa01227
|
@ -10,6 +10,12 @@ export namespace TemplateApi {
|
||||||
page_size: number;
|
page_size: number;
|
||||||
template_type?: string;
|
template_type?: string;
|
||||||
}
|
}
|
||||||
|
/** 新增模板*/
|
||||||
|
export interface TemplateAddRequest {
|
||||||
|
name?: string;
|
||||||
|
template_type?: string;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,3 +32,14 @@ export async function TemplateQueryPage(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 新增模板
|
||||||
|
|
||||||
|
export async function TemplateAdd(data: any) {
|
||||||
|
return cdcmRequestClient.post('/template', data, {
|
||||||
|
responseReturn: 'data',
|
||||||
|
headers: {
|
||||||
|
cdcm: token,
|
||||||
|
action: 52_012,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
import { ElMessage } from 'element-plus';
|
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { TemplateAdd } from '#/api/core/template';
|
||||||
import { useStaticConfigStore } from '#/store';
|
import { useStaticConfigStore } from '#/store';
|
||||||
|
|
||||||
const [Modal] = useVbenModal();
|
const [Modal] = useVbenModal();
|
||||||
|
@ -58,10 +57,10 @@ const [TemplateForm] = useVbenForm({
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
filterOption: true,
|
filterOption: true,
|
||||||
options: get_template_types(),
|
options: get_template_types(),
|
||||||
placeholder: '请选择',
|
placeholder: '选择模板',
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
},
|
},
|
||||||
fieldName: 'options',
|
fieldName: 'template_type',
|
||||||
label: '模板类型',
|
label: '模板类型',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -69,7 +68,10 @@ const [TemplateForm] = useVbenForm({
|
||||||
});
|
});
|
||||||
|
|
||||||
function onSubmit(values: Record<string, any>) {
|
function onSubmit(values: Record<string, any>) {
|
||||||
ElMessage.success(`form values: ${JSON.stringify(values)}`);
|
const ret = TemplateAdd(values);
|
||||||
|
console.warn(ret);
|
||||||
|
|
||||||
|
// ElMessage.success(`form values: ${JSON.stringify(values)}`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue