vue3最近版本代码生成模板

pull/3525/head
zhangdaiscott 2022-03-18 16:24:05 +08:00
parent ce02dbbd30
commit dad784228b
17 changed files with 52 additions and 32 deletions

View File

@ -7,7 +7,7 @@
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
@ -32,16 +32,15 @@
</div>
</template>
<script lang="ts" setup>
<script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import ${entityName}Modal from './modules/${entityName}Modal.vue'
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
import {columns, searchFormSchema} from './${entityName}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
const checkedKeys = ref<Array<string | number>>([]);
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -111,7 +110,7 @@
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
await batchDelete({ids: selectedRowKeys.value}, reload);
}
/**
* 成功回调

View File

@ -28,6 +28,8 @@ export const list = (params) =>
/**
* 删除单个
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
@ -37,6 +39,7 @@ export const deleteOne = (params,handleSuccess) => {
/**
* 批量删除
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
@ -54,6 +57,7 @@ export const batchDelete = (params, handleSuccess) => {
/**
* 保存或者更新
* @param params
* @param isUpdate 是否是更新数据
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;

View File

@ -35,6 +35,8 @@ export const searchFormSchema: FormSchema[] = [
];
export const formSchema: FormSchema[] = [
// TODO 主键隐藏字段目前写死为ID
{label: '', field: 'id', component: 'Input', show: false},
<#list columns as po><#rt/>
{
label: '${po.filedComment}',

View File

@ -8,8 +8,8 @@
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../${entityName?uncap_first}.data';
import {saveOrUpdate} from '../${entityName?uncap_first}.api';
import {formSchema} from '../${entityName}.data';
import {saveOrUpdate} from '../${entityName}.api';
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -44,7 +44,7 @@
//关闭弹窗
closeModal();
//刷新列表
emit('success');
emit('success', {isUpdate: isUpdate.value, values});
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -7,7 +7,7 @@
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
@ -38,10 +38,9 @@
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import ${entityName}Modal from './modules/${entityName}Modal.vue'
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
import {columns, searchFormSchema} from './${entityName}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
const checkedKeys = ref<Array<string | number>>([]);
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -111,7 +110,7 @@
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
await batchDelete({ids: selectedRowKeys.value}, reload);
}
/**
* 成功回调

View File

@ -28,6 +28,8 @@ export const list = (params) =>
/**
* 删除单个
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
@ -37,6 +39,7 @@ export const deleteOne = (params,handleSuccess) => {
/**
* 批量删除
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
@ -54,6 +57,7 @@ export const batchDelete = (params, handleSuccess) => {
/**
* 保存或者更新
* @param params
* @param isUpdate 是否是更新数据
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;

View File

@ -35,6 +35,8 @@ export const searchFormSchema: FormSchema[] = [
];
export const formSchema: FormSchema[] = [
// TODO 主键隐藏字段目前写死为ID
{label: '', field: 'id', component: 'Input', show: false},
<#list columns as po><#rt/>
{
label: '${po.filedComment}',

View File

@ -8,8 +8,8 @@
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../${entityName?uncap_first}.data';
import {saveOrUpdate} from '../${entityName?uncap_first}.api';
import {formSchema} from '../${entityName}.data';
import {saveOrUpdate} from '../${entityName}.api';
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
@ -44,7 +44,7 @@
//关闭弹窗
closeModal();
//刷新列表
emit('success');
emit('success', {isUpdate: isUpdate.value, values});
} finally {
setModalProps({confirmLoading: false});
}

View File

@ -7,7 +7,7 @@
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
@ -37,9 +37,8 @@
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import ${entityName}Modal from './modules/${entityName}Modal.vue'
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
const checkedKeys = ref<Array<string | number>>([]);
import {columns, searchFormSchema} from './${entityName}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
//注册model
const [registerModal, {openModal}] = useModal();
//注册table数据
@ -109,7 +108,7 @@
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
await batchDelete({ids: selectedRowKeys.value}, reload);
}
/**
* 成功回调

View File

@ -39,6 +39,8 @@ export const list = (params) =>
/**
* 删除单个
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
@ -48,6 +50,7 @@ export const deleteOne = (params,handleSuccess) => {
/**
* 批量删除
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
@ -65,6 +68,7 @@ export const batchDelete = (params, handleSuccess) => {
/**
* 保存或者更新
* @param params
* @param isUpdate 是否是更新数据
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;

View File

@ -42,7 +42,10 @@ export const searchFormSchema: FormSchema[] = [
</#if>
</#list>
];
export const formSchema: FormSchema[] = [
// TODO 主键隐藏字段目前写死为ID
{label: '', field: 'id', component: 'Input', show: false},
<#list columns as po><#rt/>
{
label: '${po.filedComment}',

View File

@ -27,10 +27,9 @@
import {ref, computed, unref,reactive} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import { JVxeTable } from '/@/components/jeecg/JVxeTable'
import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
import {formSchema<#list subTables as sub>,${sub.entityName?uncap_first}Columns</#list>} from '../${entityName?uncap_first}.data';
import {saveOrUpdate<#list subTables as sub>,${sub.entityName?uncap_first}List</#list>} from '../${entityName?uncap_first}.api';
import {formSchema<#list subTables as sub>,${sub.entityName?uncap_first}Columns</#list>} from '../${entityName}.data';
import {saveOrUpdate<#list subTables as sub>,${sub.entityName?uncap_first}List</#list>} from '../${entityName}.api';
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
// Emits声明
const emit = defineEmits(['register','success']);

View File

@ -7,7 +7,7 @@
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
@ -51,7 +51,6 @@
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
const checkedKeys = ref<Array<string | number>>([]);
const refKeys = ref([<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>]);
//注册model
const [registerModal, {openModal}] = useModal();
@ -128,7 +127,7 @@
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
await batchDelete({ids: selectedRowKeys.value}, reload);
}
/**
* 成功回调

View File

@ -37,6 +37,8 @@ export const list = (params) =>
/**
* 删除单个
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
@ -46,6 +48,7 @@ export const deleteOne = (params,handleSuccess) => {
/**
* 批量删除
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
@ -63,6 +66,7 @@ export const batchDelete = (params, handleSuccess) => {
/**
* 保存或者更新
* @param params
* @param isUpdate 是否是更新数据
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;

View File

@ -43,6 +43,8 @@ export const searchFormSchema: FormSchema[] = [
];
export const formSchema: FormSchema[] = [
// TODO 主键隐藏字段目前写死为ID
{label: '', field: 'id', component: 'Input', show: false},
<#list columns as po><#rt/>
{
label: '${po.filedComment}',

View File

@ -8,8 +8,8 @@
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../${entityName?uncap_first}.data';
import {saveOrUpdate} from '../${entityName?uncap_first}.api';
import {formSchema} from '../${entityName}.data';
import {saveOrUpdate} from '../${entityName}.api';
// Emits声明
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);

View File

@ -10,8 +10,8 @@
import {ref, computed, unref,inject} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {${subTab.entityName?uncap_first}FormSchema} from '../${entityName?uncap_first}.data';
import {${subTab.entityName?uncap_first}Save} from '../${entityName?uncap_first}.api';
import {${subTab.entityName?uncap_first}FormSchema} from '../${entityName}.data';
import {${subTab.entityName?uncap_first}Save} from '../${entityName}.api';
// Emits声明
const emit = defineEmits(['register','success']);
//接收主表id