worsoft-frontend-codegen-local-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MVP_DESIGN.md +78 -0
- package/README.md +121 -0
- package/assets/style-catalog.json +71 -0
- package/assets/templates/master_child_jump/api.tpl +49 -0
- package/assets/templates/master_child_jump/form.tpl +130 -0
- package/assets/templates/master_child_jump/index.tpl +99 -0
- package/assets/templates/master_child_jump/menu.sql.tpl +21 -0
- package/assets/templates/master_child_jump/options.tpl +10 -0
- package/assets/templates/single_table_dialog/api.tpl +41 -0
- package/assets/templates/single_table_dialog/form.tpl +91 -0
- package/assets/templates/single_table_dialog/index.tpl +86 -0
- package/assets/templates/single_table_dialog/menu.sql.tpl +21 -0
- package/assets/templates/single_table_dialog/options.tpl +10 -0
- package/assets/templates/single_table_jump/api.tpl +41 -0
- package/assets/templates/single_table_jump/form.tpl +105 -0
- package/assets/templates/single_table_jump/index.tpl +99 -0
- package/assets/templates/single_table_jump/menu.sql.tpl +21 -0
- package/assets/templates/single_table_jump/options.tpl +10 -0
- package/mcp_server.js +1013 -0
- package/package.json +23 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog v-model="visible" :title="form.{{PK_ATTR}} ? 'Edit' : 'Add'" :close-on-click-modal="false" draggable>
|
|
3
|
+
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="100px" v-loading="loading">
|
|
4
|
+
<el-row :gutter="24">
|
|
5
|
+
{{FORM_FIELDS}}
|
|
6
|
+
</el-row>
|
|
7
|
+
</el-form>
|
|
8
|
+
<template #footer>
|
|
9
|
+
<span class="dialog-footer">
|
|
10
|
+
<el-button @click="visible = false">Cancel</el-button>
|
|
11
|
+
<el-button type="primary" @click="onSubmit" :disabled="loading">Confirm</el-button>
|
|
12
|
+
</span>
|
|
13
|
+
</template>
|
|
14
|
+
</el-dialog>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts" name="{{CLASS_NAME}}Dialog">
|
|
18
|
+
import { useMessage } from '/@/hooks/message';
|
|
19
|
+
import { getObj, addObj, putObj } from '/@/api/{{API_MODULE_PATH}}';
|
|
20
|
+
{{FORM_DICT_IMPORT_BLOCK}}
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits(['refresh']);
|
|
23
|
+
|
|
24
|
+
const dataFormRef = ref();
|
|
25
|
+
const visible = ref(false);
|
|
26
|
+
const loading = ref(false);
|
|
27
|
+
|
|
28
|
+
const form = reactive({
|
|
29
|
+
{{FORM_DEFAULTS}}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const dataRules = ref({
|
|
33
|
+
{{FORM_RULES}}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
37
|
+
try {
|
|
38
|
+
loading.value = true;
|
|
39
|
+
const { data } = await getObj({ {{PK_ATTR}}: id });
|
|
40
|
+
Object.assign(form, data[0] || {});
|
|
41
|
+
} catch (error) {
|
|
42
|
+
useMessage().error('Failed to fetch data');
|
|
43
|
+
} finally {
|
|
44
|
+
loading.value = false;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const resetFormState = () => {
|
|
49
|
+
Object.assign(form, {
|
|
50
|
+
{{FORM_DEFAULTS}}
|
|
51
|
+
});
|
|
52
|
+
nextTick(() => {
|
|
53
|
+
dataFormRef.value?.resetFields();
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const openDialog = async (id?: string) => {
|
|
58
|
+
visible.value = true;
|
|
59
|
+
resetFormState();
|
|
60
|
+
|
|
61
|
+
if (id) {
|
|
62
|
+
form.{{PK_ATTR}} = id;
|
|
63
|
+
await get{{CLASS_NAME}}Data(id);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const onSubmit = async () => {
|
|
68
|
+
loading.value = true;
|
|
69
|
+
|
|
70
|
+
const valid = await dataFormRef.value.validate().catch(() => {});
|
|
71
|
+
if (!valid) {
|
|
72
|
+
loading.value = false;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
form.{{PK_ATTR}} ? await putObj(form) : await addObj(form);
|
|
78
|
+
useMessage().success(form.{{PK_ATTR}} ? 'Updated successfully' : 'Created successfully');
|
|
79
|
+
visible.value = false;
|
|
80
|
+
emit('refresh');
|
|
81
|
+
} catch (err: any) {
|
|
82
|
+
useMessage().error(err.msg || 'Submit failed');
|
|
83
|
+
} finally {
|
|
84
|
+
loading.value = false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
defineExpose({
|
|
89
|
+
openDialog,
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-padding">
|
|
3
|
+
<div class="layout-padding-auto layout-padding-view">
|
|
4
|
+
<el-row>
|
|
5
|
+
<div class="mb8" style="width: 100%">
|
|
6
|
+
<el-button icon="folder-add" type="primary" class="ml10" v-auth="'{{PERMISSION_PREFIX}}_add'" @click="formDialogRef.openDialog()">新增</el-button>
|
|
7
|
+
<el-button plain icon="upload-filled" type="primary" class="ml10" v-auth="'{{PERMISSION_PREFIX}}_add'" @click="excelUploadRef.show()">导入</el-button>
|
|
8
|
+
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'{{PERMISSION_PREFIX}}_del'" @click="handleDelete(selectObjs)">删除</el-button>
|
|
9
|
+
<right-toolbar v-model:showSearch="showSearch" :export="'{{PERMISSION_PREFIX}}_export'" @exportExcel="exportExcel" @queryTable="getDataList" class="ml10 mr20" style="float: right;" />
|
|
10
|
+
</div>
|
|
11
|
+
</el-row>
|
|
12
|
+
|
|
13
|
+
<el-table
|
|
14
|
+
:data="state.dataList"
|
|
15
|
+
v-loading="state.loading"
|
|
16
|
+
border
|
|
17
|
+
:cell-style="tableStyle.cellStyle"
|
|
18
|
+
:header-cell-style="tableStyle.headerCellStyle"
|
|
19
|
+
@selection-change="selectionChangeHandle"
|
|
20
|
+
@sort-change="sortChangeHandle"
|
|
21
|
+
>
|
|
22
|
+
<el-table-column type="selection" width="40" align="center" />
|
|
23
|
+
<el-table-column type="index" label="#" width="40" />
|
|
24
|
+
{{TABLE_COLUMNS}}
|
|
25
|
+
<el-table-column label="操作" width="180">
|
|
26
|
+
<template #default="scope">
|
|
27
|
+
<el-button icon="edit-pen" text type="primary" v-auth="'{{PERMISSION_PREFIX}}_edit'" @click="formDialogRef.openDialog(scope.row.{{PK_ATTR}})">编辑</el-button>
|
|
28
|
+
<el-button icon="delete" text type="primary" v-auth="'{{PERMISSION_PREFIX}}_del'" @click="handleDelete([scope.row.{{PK_ATTR}}])">删除</el-button>
|
|
29
|
+
</template>
|
|
30
|
+
</el-table-column>
|
|
31
|
+
</el-table>
|
|
32
|
+
|
|
33
|
+
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
|
37
|
+
<upload-excel ref="excelUploadRef" title="导入" url="/{{API_PATH}}/import" temp-url="/admin/sys-file/local/file/{{FUNCTION_NAME}}.xlsx" @refreshDataList="getDataList" />
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts" name="system{{CLASS_NAME}}">
|
|
42
|
+
import { BasicTableProps, useTable } from '/@/hooks/table';
|
|
43
|
+
import { fetchList, delObjs } from '/@/api/{{API_MODULE_PATH}}';
|
|
44
|
+
import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
45
|
+
{{TABLE_DICT_IMPORT_BLOCK}}
|
|
46
|
+
|
|
47
|
+
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
|
48
|
+
|
|
49
|
+
const formDialogRef = ref();
|
|
50
|
+
const excelUploadRef = ref();
|
|
51
|
+
const showSearch = ref(true);
|
|
52
|
+
const selectObjs = ref([]) as any;
|
|
53
|
+
const multiple = ref(true);
|
|
54
|
+
|
|
55
|
+
const state: BasicTableProps = reactive<BasicTableProps>({
|
|
56
|
+
queryForm: {},
|
|
57
|
+
pageList: fetchList,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
|
61
|
+
|
|
62
|
+
const exportExcel = () => {
|
|
63
|
+
downBlobFile('/{{API_PATH}}/export', { ...state.queryForm, ids: selectObjs.value }, '{{FUNCTION_NAME}}.xlsx');
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const selectionChangeHandle = (objs: { {{PK_ATTR}}: string }[]) => {
|
|
67
|
+
selectObjs.value = objs.map((item) => item.{{PK_ATTR}});
|
|
68
|
+
multiple.value = !objs.length;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleDelete = async (ids: string[]) => {
|
|
72
|
+
try {
|
|
73
|
+
await useMessageBox().confirm('此操作将永久删除');
|
|
74
|
+
} catch {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
await delObjs(ids);
|
|
80
|
+
getDataList();
|
|
81
|
+
useMessage().success('删除成功');
|
|
82
|
+
} catch (err: any) {
|
|
83
|
+
useMessage().error(err.msg || '删除失败');
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Do not execute directly. Review parent menu id and tenant settings before import.
|
|
2
|
+
-- Suggested default parent_id: -1
|
|
3
|
+
-- Generated by worsoft-codegen-local on {{GENERATED_AT}}
|
|
4
|
+
|
|
5
|
+
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
6
|
+
values ({{MENU_BASE_ID}}, '-1', '/{{MENU_ROUTE_PATH}}/index', '', '0', 'icon-bangzhushouji', '0', null, '8', null, '{{TABLE_COMMENT}}管理', 1);
|
|
7
|
+
|
|
8
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
9
|
+
values ({{MENU_BASE_ID_PLUS_1}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_view', '1', null, '1', '0', null, '0', null, '{{TABLE_COMMENT}}查看', 1);
|
|
10
|
+
|
|
11
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
12
|
+
values ({{MENU_BASE_ID_PLUS_2}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_add', '1', null, '1', '0', null, '1', null, '{{TABLE_COMMENT}}新增', 1);
|
|
13
|
+
|
|
14
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
15
|
+
values ({{MENU_BASE_ID_PLUS_3}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_edit', '1', null, '1', '0', null, '2', null, '{{TABLE_COMMENT}}修改', 1);
|
|
16
|
+
|
|
17
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
18
|
+
values ({{MENU_BASE_ID_PLUS_4}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_del', '1', null, '1', '0', null, '3', null, '{{TABLE_COMMENT}}删除', 1);
|
|
19
|
+
|
|
20
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
21
|
+
values ({{MENU_BASE_ID_PLUS_5}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_export', '1', null, '1', '0', null, '4', null, '导入导出', 1);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import request from '/@/utils/request';
|
|
2
|
+
|
|
3
|
+
export function fetchList(query?: object) {
|
|
4
|
+
return request({
|
|
5
|
+
url: '/{{API_PATH}}/page',
|
|
6
|
+
method: 'get',
|
|
7
|
+
params: query,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function addObj(obj?: object) {
|
|
12
|
+
return request({
|
|
13
|
+
url: '/{{API_PATH}}',
|
|
14
|
+
method: 'post',
|
|
15
|
+
data: obj,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getObj(obj?: object) {
|
|
20
|
+
return request({
|
|
21
|
+
url: '/{{API_PATH}}/details',
|
|
22
|
+
method: 'get',
|
|
23
|
+
params: obj,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function delObjs(ids?: object) {
|
|
28
|
+
return request({
|
|
29
|
+
url: '/{{API_PATH}}',
|
|
30
|
+
method: 'delete',
|
|
31
|
+
data: ids,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function putObj(obj?: object) {
|
|
36
|
+
return request({
|
|
37
|
+
url: '/{{API_PATH}}',
|
|
38
|
+
method: 'put',
|
|
39
|
+
data: obj,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-padding-auto layout-padding-view">
|
|
3
|
+
<el-card shadow="never">
|
|
4
|
+
<template #header>
|
|
5
|
+
<span>{{ form.{{PK_ATTR}} ? (detail ? 'Detail' : 'Edit') : 'Add' }}</span>
|
|
6
|
+
</template>
|
|
7
|
+
<el-form ref="dataFormRef" :model="form" :rules="dataRules" :disabled="detail" v-loading="loading">
|
|
8
|
+
<el-row :gutter="24">
|
|
9
|
+
{{FORM_FIELDS}}
|
|
10
|
+
</el-row>
|
|
11
|
+
</el-form>
|
|
12
|
+
<div class="dialog-footer" style="text-align: right; margin-top: 18px;">
|
|
13
|
+
<el-button @click="handleBack">Cancel</el-button>
|
|
14
|
+
<el-button type="primary" @click="onSubmit" :disabled="loading">Confirm</el-button>
|
|
15
|
+
</div>
|
|
16
|
+
</el-card>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts" name="{{CLASS_NAME}}Form">
|
|
21
|
+
import mittBus from '/@/utils/mitt';
|
|
22
|
+
import { useMessage } from '/@/hooks/message';
|
|
23
|
+
import { getObj, addObj, putObj } from '/@/api/{{API_MODULE_PATH}}';
|
|
24
|
+
{{DICT_IMPORT_BLOCK}}
|
|
25
|
+
const route = useRoute();
|
|
26
|
+
const router = useRouter();
|
|
27
|
+
|
|
28
|
+
const dataFormRef = ref();
|
|
29
|
+
const loading = ref(false);
|
|
30
|
+
const detail = ref(false);
|
|
31
|
+
|
|
32
|
+
const form = reactive({
|
|
33
|
+
{{FORM_DEFAULTS}}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const dataRules = ref({
|
|
37
|
+
{{FORM_RULES}}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const get{{CLASS_NAME}}Data = async (id: string) => {
|
|
41
|
+
try {
|
|
42
|
+
loading.value = true;
|
|
43
|
+
const { data } = await getObj({ {{PK_ATTR}}: id });
|
|
44
|
+
Object.assign(form, data[0] || {});
|
|
45
|
+
} catch (error) {
|
|
46
|
+
useMessage().error('Failed to fetch data');
|
|
47
|
+
} finally {
|
|
48
|
+
loading.value = false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const resetFormState = () => {
|
|
53
|
+
Object.assign(form, {
|
|
54
|
+
{{FORM_DEFAULTS}}
|
|
55
|
+
});
|
|
56
|
+
nextTick(() => {
|
|
57
|
+
dataFormRef.value?.resetFields();
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const initPage = async () => {
|
|
62
|
+
const id = route.query.id as string;
|
|
63
|
+
const isDetail = route.query.detail === 'true' || route.query.detail === '1';
|
|
64
|
+
|
|
65
|
+
detail.value = isDetail;
|
|
66
|
+
resetFormState();
|
|
67
|
+
|
|
68
|
+
if (id) {
|
|
69
|
+
form.{{PK_ATTR}} = id;
|
|
70
|
+
await get{{CLASS_NAME}}Data(id);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const closeCurrentPage = () => {
|
|
75
|
+
mittBus.emit('onCurrentContextmenuClick', { contextMenuClickId: 1, ...route });
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const handleBack = () => {
|
|
79
|
+
router.back();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onSubmit = async () => {
|
|
83
|
+
loading.value = true;
|
|
84
|
+
|
|
85
|
+
const valid = await dataFormRef.value.validate().catch(() => {});
|
|
86
|
+
if (!valid) {
|
|
87
|
+
loading.value = false;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
form.{{PK_ATTR}} ? await putObj(form) : await addObj(form);
|
|
93
|
+
useMessage().success(form.{{PK_ATTR}} ? 'Updated successfully' : 'Created successfully');
|
|
94
|
+
closeCurrentPage();
|
|
95
|
+
} catch (err: any) {
|
|
96
|
+
useMessage().error(err.msg || 'Submit failed');
|
|
97
|
+
} finally {
|
|
98
|
+
loading.value = false;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
onMounted(() => {
|
|
103
|
+
initPage();
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="layout-padding">
|
|
3
|
+
<div class="layout-padding-auto layout-padding-view">
|
|
4
|
+
<el-row>
|
|
5
|
+
<div class="mb8" style="width: 100%">
|
|
6
|
+
<el-button icon="folder-add" type="primary" class="ml10" v-auth="'{{PERMISSION_PREFIX}}_add'" @click="handleCreate">新增</el-button>
|
|
7
|
+
<el-button plain icon="upload-filled" type="primary" class="ml10" v-auth="'{{PERMISSION_PREFIX}}_add'" @click="excelUploadRef.show()">导入</el-button>
|
|
8
|
+
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'{{PERMISSION_PREFIX}}_del'" @click="handleDelete(selectObjs)">删除</el-button>
|
|
9
|
+
<right-toolbar v-model:showSearch="showSearch" :export="'{{PERMISSION_PREFIX}}_export'" @exportExcel="exportExcel" @queryTable="getDataList" class="ml10 mr20" style="float: right;" />
|
|
10
|
+
</div>
|
|
11
|
+
</el-row>
|
|
12
|
+
|
|
13
|
+
<el-table
|
|
14
|
+
:data="state.dataList"
|
|
15
|
+
v-loading="state.loading"
|
|
16
|
+
border
|
|
17
|
+
:cell-style="tableStyle.cellStyle"
|
|
18
|
+
:header-cell-style="tableStyle.headerCellStyle"
|
|
19
|
+
@selection-change="selectionChangeHandle"
|
|
20
|
+
@sort-change="sortChangeHandle"
|
|
21
|
+
>
|
|
22
|
+
<el-table-column type="selection" width="40" align="center" />
|
|
23
|
+
<el-table-column type="index" label="#" width="40" />
|
|
24
|
+
{{TABLE_COLUMNS}}
|
|
25
|
+
<el-table-column label="操作" width="220">
|
|
26
|
+
<template #default="scope">
|
|
27
|
+
<el-button text type="primary" icon="view" v-auth="'{{PERMISSION_PREFIX}}_view'" @click="handleDetail(scope.row.{{PK_ATTR}})">查看</el-button>
|
|
28
|
+
<el-button icon="edit-pen" text type="primary" v-auth="'{{PERMISSION_PREFIX}}_edit'" @click="handleEdit(scope.row.{{PK_ATTR}})">编辑</el-button>
|
|
29
|
+
<el-button icon="delete" text type="primary" v-auth="'{{PERMISSION_PREFIX}}_del'" @click="handleDelete([scope.row.{{PK_ATTR}}])">删除</el-button>
|
|
30
|
+
</template>
|
|
31
|
+
</el-table-column>
|
|
32
|
+
</el-table>
|
|
33
|
+
|
|
34
|
+
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<upload-excel ref="excelUploadRef" title="导入" url="/{{API_PATH}}/import" temp-url="/admin/sys-file/local/file/{{FUNCTION_NAME}}.xlsx" @refreshDataList="getDataList" />
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts" name="system{{CLASS_NAME}}">
|
|
42
|
+
import { BasicTableProps, useTable } from '/@/hooks/table';
|
|
43
|
+
import { fetchList, delObjs } from '/@/api/{{API_MODULE_PATH}}';
|
|
44
|
+
import { useMessage, useMessageBox } from '/@/hooks/message';
|
|
45
|
+
{{DICT_IMPORT_BLOCK}}
|
|
46
|
+
const router = useRouter();
|
|
47
|
+
|
|
48
|
+
const excelUploadRef = ref();
|
|
49
|
+
const queryRef = ref();
|
|
50
|
+
const showSearch = ref(true);
|
|
51
|
+
const selectObjs = ref([]) as any;
|
|
52
|
+
const multiple = ref(true);
|
|
53
|
+
|
|
54
|
+
const state: BasicTableProps = reactive<BasicTableProps>({
|
|
55
|
+
queryForm: {},
|
|
56
|
+
pageList: fetchList,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
|
60
|
+
|
|
61
|
+
const getFormPath = () => '/{{VIEW_MODULE_PATH}}/form';
|
|
62
|
+
|
|
63
|
+
const handleCreate = () => {
|
|
64
|
+
router.push({ path: getFormPath(), query: { tagsViewName: '新增' } });
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleDetail = (id: string) => {
|
|
68
|
+
router.push({ path: getFormPath(), query: { id, detail: '1', tagsViewName: '查看' } });
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleEdit = (id: string) => {
|
|
72
|
+
router.push({ path: getFormPath(), query: { id, tagsViewName: '编辑' } });
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const exportExcel = () => {
|
|
76
|
+
downBlobFile('/{{API_PATH}}/export', { ...state.queryForm, ids: selectObjs.value }, '{{FUNCTION_NAME}}.xlsx');
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const selectionChangeHandle = (objs: { {{PK_ATTR}}: string }[]) => {
|
|
80
|
+
selectObjs.value = objs.map((item) => item.{{PK_ATTR}});
|
|
81
|
+
multiple.value = !objs.length;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleDelete = async (ids: string[]) => {
|
|
85
|
+
try {
|
|
86
|
+
await useMessageBox().confirm('此操作将永久删除');
|
|
87
|
+
} catch {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
await delObjs(ids);
|
|
93
|
+
getDataList();
|
|
94
|
+
useMessage().success('删除成功');
|
|
95
|
+
} catch (err: any) {
|
|
96
|
+
useMessage().error(err.msg || '删除失败');
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Do not execute directly. Review parent menu id and tenant settings before import.
|
|
2
|
+
-- Suggested default parent_id: -1
|
|
3
|
+
-- Generated by worsoft-codegen-local on {{GENERATED_AT}}
|
|
4
|
+
|
|
5
|
+
insert into sys_menu (menu_id, parent_id, path, permission, menu_type, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
6
|
+
values ({{MENU_BASE_ID}}, '-1', '/{{MENU_ROUTE_PATH}}/index', '', '0', 'icon-bangzhushouji', '0', null, '8', null, '{{TABLE_COMMENT}}管理', 1);
|
|
7
|
+
|
|
8
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
9
|
+
values ({{MENU_BASE_ID_PLUS_1}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_view', '1', null, '1', '0', null, '0', null, '{{TABLE_COMMENT}}查看', 1);
|
|
10
|
+
|
|
11
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
12
|
+
values ({{MENU_BASE_ID_PLUS_2}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_add', '1', null, '1', '0', null, '1', null, '{{TABLE_COMMENT}}新增', 1);
|
|
13
|
+
|
|
14
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
15
|
+
values ({{MENU_BASE_ID_PLUS_3}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_edit', '1', null, '1', '0', null, '2', null, '{{TABLE_COMMENT}}修改', 1);
|
|
16
|
+
|
|
17
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
18
|
+
values ({{MENU_BASE_ID_PLUS_4}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_del', '1', null, '1', '0', null, '3', null, '{{TABLE_COMMENT}}删除', 1);
|
|
19
|
+
|
|
20
|
+
insert into sys_menu (menu_id, parent_id, permission, menu_type, path, icon, del_flag, create_time, sort_order, update_time, name, tenant_id)
|
|
21
|
+
values ({{MENU_BASE_ID_PLUS_5}}, {{MENU_BASE_ID}}, '{{PERMISSION_PREFIX}}_export', '1', null, '1', '0', null, '4', null, '导入导出', 1);
|