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