修改
This commit is contained in:
parent
078ed98c52
commit
87ef39f072
@ -8,9 +8,9 @@ import { Card, message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
postGeneratorDown,
|
||||
postProjectsAll,
|
||||
postTemplatesAll,
|
||||
// postGeneratorDown,
|
||||
// postProjectsAll,
|
||||
// postTemplatesAll,
|
||||
} from '#/api-client/index';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
@ -62,50 +62,45 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
||||
],
|
||||
});
|
||||
onMounted(async () => {
|
||||
const res = await postProjectsAll();
|
||||
baseFormApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: res?.data?.map((item) => ({
|
||||
label: item.projectName,
|
||||
value: item.id,
|
||||
})),
|
||||
},
|
||||
fieldName: 'projectId',
|
||||
},
|
||||
]);
|
||||
const res2 = await postTemplatesAll();
|
||||
baseFormApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: res2?.data?.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})),
|
||||
},
|
||||
fieldName: 'templateId',
|
||||
},
|
||||
]);
|
||||
// const res = await postProjectsAll();
|
||||
// baseFormApi.updateSchema([
|
||||
// {
|
||||
// componentProps: {
|
||||
// options: res?.data?.map((item) => ({
|
||||
// label: item.projectName,
|
||||
// value: item.id,
|
||||
// })),
|
||||
// },
|
||||
// fieldName: 'projectId',
|
||||
// },
|
||||
// ]);
|
||||
// const res2 = await postTemplatesAll();
|
||||
// baseFormApi.updateSchema([
|
||||
// {
|
||||
// componentProps: {
|
||||
// options: res2?.data?.map((item) => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// })),
|
||||
// },
|
||||
// fieldName: 'templateId',
|
||||
// },
|
||||
// ]);
|
||||
});
|
||||
async function onSubmit() {
|
||||
try {
|
||||
baseFormApi.setState({ submitButtonOptions: { loading: true } });
|
||||
const formValues = await baseFormApi.getValues();
|
||||
const { data } = await postGeneratorDown({
|
||||
body: { ...formValues },
|
||||
responseType: 'blob',
|
||||
});
|
||||
const url = window.URL.createObjectURL(new Blob([data as Blob]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', '源码.zip');
|
||||
document.body.append(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
message.success({
|
||||
content: '下载成功,请在浏览器右上角下载查看源码.zip',
|
||||
});
|
||||
// const { data } = await postGeneratorDown({
|
||||
// body: { ...formValues },
|
||||
// responseType: 'blob',
|
||||
// });
|
||||
// const url = window.URL.createObjectURL(new Blob([data as Blob]));
|
||||
// const link = document.createElement('a');
|
||||
// link.href = url;
|
||||
message.success('功能暂时不可用');
|
||||
} catch (error) {
|
||||
message.error('操作失败');
|
||||
} finally {
|
||||
baseFormApi.setState({ submitButtonOptions: { loading: false } });
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { postProjectsCreate } from '#/api-client/index';
|
||||
// import { postProjectsCreate } from '#/api-client/index';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { addFormSchema } from './schema';
|
||||
@ -37,7 +37,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
// 获取表单值
|
||||
const values = await formApi.getValues();
|
||||
// 编辑
|
||||
await postProjectsCreate({ body: { ...values } });
|
||||
// await postProjectsCreate({ body: { ...values } });
|
||||
message.success($t('common.addSuccess'));
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
|
||||
@ -6,7 +6,7 @@ import { useVbenModal } from '@vben/common-ui';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { postProjectsUpdate } from '#/api-client/index';
|
||||
// import { postProjectsUpdate } from '#/api-client/index';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { editFormSchema } from './schema';
|
||||
@ -40,7 +40,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
// 获取表单值
|
||||
const values = await formApi.getValues();
|
||||
// 编辑
|
||||
await postProjectsUpdate({ body: { ...values } });
|
||||
// await postProjectsUpdate({ body: { ...values } });
|
||||
message.success($t('common.editSuccess'));
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
|
||||
@ -10,7 +10,7 @@ import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { Modal, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postProjectsDelete, postProjectsPage } from '#/api-client/index';
|
||||
// import { postProjectsDelete, postProjectsPage } from '#/api-client/index';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
@ -50,14 +50,15 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postProjectsPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
// const { data } = await postProjectsPage({
|
||||
// body: {
|
||||
// pageIndex: page.currentPage,
|
||||
// pageSize: page.pageSize,
|
||||
// ...formValues,
|
||||
// },
|
||||
// });
|
||||
// return data;
|
||||
return { items: [], totalCount: 0 };
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -88,11 +89,11 @@ const handleDelete = (row: any) => {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}?`,
|
||||
onOk: async () => {
|
||||
await postProjectsDelete({
|
||||
body: {
|
||||
id: row.id,
|
||||
},
|
||||
});
|
||||
// await postProjectsDelete({
|
||||
// body: {
|
||||
// id: row.id,
|
||||
// },
|
||||
// });
|
||||
gridApi.reload();
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user