parent
9760185bf6
commit
0acea1abff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,24 +0,0 @@
|
||||
package org.jeecg.common.api;
|
||||
|
||||
import org.jeecg.common.api.vo.OaWpsModel;
|
||||
|
||||
/**
|
||||
* @Description: WPS通用接口
|
||||
* @Author: wangshuai
|
||||
* @Date:20200709
|
||||
* @Version:V1.0
|
||||
*/
|
||||
public interface IWpsBaseAPI {
|
||||
|
||||
/*根据模板id获取模板信息*/
|
||||
OaWpsModel getById(String id);
|
||||
|
||||
/*根据文件路径下载文件*/
|
||||
void downloadOosFiles(String objectName, String basePath,String fileName);
|
||||
|
||||
/*WPS 设置数据存储,用于逻辑判断*/
|
||||
void context(String type,String text);
|
||||
|
||||
/*删除WPS模板相关信息*/
|
||||
void deleteById(String id);
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
package org.jeecg.common.api.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 文档
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2020-06-09
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("oa_wps_file")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "oa_wps_file对象", description = "文档")
|
||||
public class OaWpsModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
/**
|
||||
* name
|
||||
*/
|
||||
@Excel(name = "name", width = 15)
|
||||
@ApiModelProperty(value = "name")
|
||||
private String name;
|
||||
/**
|
||||
* version
|
||||
*/
|
||||
@Excel(name = "version", width = 15)
|
||||
@ApiModelProperty(value = "version")
|
||||
private Integer version;
|
||||
/**
|
||||
* size
|
||||
*/
|
||||
@Excel(name = "size", width = 15)
|
||||
@ApiModelProperty(value = "size")
|
||||
private Integer size;
|
||||
/**
|
||||
* downloadUrl
|
||||
*/
|
||||
@Excel(name = "downloadUrl", width = 15)
|
||||
@ApiModelProperty(value = "downloadUrl")
|
||||
private String downloadUrl;
|
||||
/**
|
||||
* deleted
|
||||
*/
|
||||
@Excel(name = "deleted", width = 15)
|
||||
@ApiModelProperty(value = "deleted")
|
||||
private String deleted;
|
||||
/**
|
||||
* canDelete
|
||||
*/
|
||||
@Excel(name = "canDelete", width = 15)
|
||||
@ApiModelProperty(value = "canDelete")
|
||||
private String canDelete;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 组织机构编码
|
||||
*/
|
||||
@ApiModelProperty(value = "组织机构编码")
|
||||
private String sysOrgCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userId;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.jeecg.common.exception;
|
||||
|
||||
public class JeecgBoot401Exception extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JeecgBoot401Exception(String message){
|
||||
super(message);
|
||||
}
|
||||
|
||||
public JeecgBoot401Exception(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public JeecgBoot401Exception(String message, Throwable cause)
|
||||
{
|
||||
super(message,cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 加载项目配置
|
||||
*/
|
||||
@Component("jeeccgBaseConfig")
|
||||
@ConfigurationProperties(prefix = "jeecg")
|
||||
public class JeeccgBaseConfig {
|
||||
/**
|
||||
* 是否启用安全模式
|
||||
*/
|
||||
private Boolean safeMode = false;
|
||||
|
||||
public Boolean getSafeMode() {
|
||||
return safeMode;
|
||||
}
|
||||
|
||||
public void setSafeMode(Boolean safeMode) {
|
||||
this.safeMode = safeMode;
|
||||
}
|
||||
}
|
@ -1,29 +1,23 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "系统监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "系统监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
]
|
@ -1,29 +1,23 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 11,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "系统管理",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": 11,
|
||||
"name": "首页",
|
||||
"component": "dashboard/Analysis",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"name": "系统管理",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"name": "常见案例",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 3,
|
||||
"hasChildren": true
|
||||
}
|
||||
]
|
@ -1,29 +1,23 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 21,
|
||||
"name": "弹框选择Demo",
|
||||
"component": "jeecg/SelectDemo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"name": "单表模型示例",
|
||||
"component": "jeecg/JeecgDemoList",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "一对多Tab示例",
|
||||
"component": "jeecg/tablist/JeecgOrderDMainList",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": 21,
|
||||
"name": "弹框选择Demo",
|
||||
"component": "jeecg/SelectDemo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"name": "单表模型示例",
|
||||
"component": "jeecg/JeecgDemoList",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"name": "一对多Tab示例",
|
||||
"component": "jeecg/tablist/JeecgOrderDMainList",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
]
|
@ -1,29 +1,23 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 31,
|
||||
"name": "性能监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 1,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"name": "在线文档",
|
||||
"component": "layouts/IframePageView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"name": "工作台",
|
||||
"component": "dashboard/Workplace",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": 31,
|
||||
"name": "性能监控",
|
||||
"component": "layouts/RouteView",
|
||||
"orderNum": 1,
|
||||
"hasChildren": true
|
||||
},
|
||||
{
|
||||
"id": 32,
|
||||
"name": "在线文档",
|
||||
"component": "layouts/IframePageView",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 33,
|
||||
"name": "工作台",
|
||||
"component": "dashboard/Workplace",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
]
|
@ -1,29 +1,23 @@
|
||||
{
|
||||
"status": 200,
|
||||
"success": true,
|
||||
"message": "ok",
|
||||
"result": [
|
||||
{
|
||||
"id": 311,
|
||||
"name": "Redis监控",
|
||||
"component": "modules/monitor/RedisInfo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 312,
|
||||
"name": "JVM信息",
|
||||
"component": "modules/monitor/JvmInfo",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 313,
|
||||
"name": "Tomcat信息",
|
||||
"component": "modules/monitor/TomcatInfo",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
],
|
||||
"timestamp": 1554950583837
|
||||
}
|
||||
[
|
||||
{
|
||||
"id": 311,
|
||||
"name": "Redis监控",
|
||||
"component": "modules/monitor/RedisInfo",
|
||||
"orderNum": 1,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 312,
|
||||
"name": "JVM信息",
|
||||
"component": "modules/monitor/JvmInfo",
|
||||
"orderNum": 2,
|
||||
"hasChildren": false
|
||||
},
|
||||
{
|
||||
"id": 313,
|
||||
"name": "Tomcat信息",
|
||||
"component": "modules/monitor/TomcatInfo",
|
||||
"orderNum": 3,
|
||||
"hasChildren": false
|
||||
}
|
||||
]
|
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* vue3前端临时接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
@Slf4j
|
||||
public class MockVue3Controller {
|
||||
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
//package org.jeecg.modules.system.util;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
///**
|
||||
// * 多租户 tenant_id存储器
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class TenantContext {
|
||||
//
|
||||
// private static ThreadLocal<String> currentTenant = new ThreadLocal<>();
|
||||
//
|
||||
// public static void setTenant(String tenant) {
|
||||
// log.debug(" setting tenant to " + tenant);
|
||||
// currentTenant.set(tenant);
|
||||
// }
|
||||
//
|
||||
// public static String getTenant() {
|
||||
// return currentTenant.get();
|
||||
// }
|
||||
//
|
||||
// public static void clear(){
|
||||
// currentTenant.remove();
|
||||
// }
|
||||
//}
|
@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<ExcelButton :config="excelConfig"></ExcelButton>
|
||||
<a-dropdown v-if="checkedKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{text}">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template #fileSlot="{text}">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref} from 'vue';
|
||||
import {BasicTable, useTable, TableAction} from '/@/components/Table';
|
||||
import ExcelButton from '/@/components/jeecg/ExcelButton.vue'
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue'
|
||||
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '/@/api/common/api'
|
||||
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
||||
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
|
||||
</#if>
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const [registerTable, {reload}] = useTable({
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToTime: [
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#if po.queryMode!='single'>
|
||||
<#if po.classType=='date'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end'], 'YYYY-MM-DD'],
|
||||
<#elseif po.classType=='datetime'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end'], 'YYYY-MM-DD HH:mm:ss'],
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
],
|
||||
},
|
||||
striped: true,
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
clickToRowSelect: false,
|
||||
bordered: true,
|
||||
showIndexColumn: false,
|
||||
tableSetting: {fullScreen: true},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: {customRender: 'action'},
|
||||
fixed: 'right',
|
||||
},
|
||||
})
|
||||
/**
|
||||
* excel导入导出配置
|
||||
*/
|
||||
const excelConfig = {
|
||||
export: {
|
||||
name:'${tableVo.ftlDescription}',
|
||||
url: getExportUrl,
|
||||
},
|
||||
import: {
|
||||
url: getImportUrl,
|
||||
success: reload,
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 选择列配置
|
||||
*/
|
||||
const rowSelection = {
|
||||
type: 'checkbox',
|
||||
columnWidth: 30,
|
||||
selectedRowKeys: checkedKeys,
|
||||
onChange: onSelectChange
|
||||
}
|
||||
/**
|
||||
* 选择事件
|
||||
*/
|
||||
function onSelectChange(selectedRowKeys: (string | number)[]) {
|
||||
checkedKeys.value = selectedRowKeys;
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({id: record.id}, reload);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: checkedKeys.value}, reload);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
<#if list_need_category>
|
||||
/**
|
||||
* 初始化字典配置
|
||||
*/
|
||||
function initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
|
||||
if (res) {
|
||||
let allDictDate = getAuthCache(DB_DICT_DATA_KEY);
|
||||
if(!allDictDate['${po.dictField?default("")}']){
|
||||
Object.assign(allDictDate,{'${po.dictField?default("")}':res})
|
||||
}
|
||||
setAuthCache(DB_DICT_DATA_KEY,allDictDate)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
initDictConfig();
|
||||
</#if>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,61 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import {Modal} from 'ant-design-vue';
|
||||
|
||||
enum Api {
|
||||
list = '/${entityPackage}/${entityName?uncap_first}/list',
|
||||
save='/${entityPackage}/${entityName?uncap_first}/add',
|
||||
edit='/${entityPackage}/${entityName?uncap_first}/edit',
|
||||
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
|
||||
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
|
||||
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
|
||||
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm"/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
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';
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
//表单配置
|
||||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({confirmLoading: false,showFooter:!!data?.showFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (unref(isUpdate)) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !data?.showFooter })
|
||||
});
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
//表单提交事件
|
||||
async function handleSubmit(v) {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//刷新列表
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,82 @@
|
||||
import {defHttp} from "/@/utils/http/axios";
|
||||
import {Modal} from 'ant-design-vue';
|
||||
|
||||
enum Api {
|
||||
list = '/${entityPackage}/${entityName?uncap_first}/rootList',
|
||||
save='/${entityPackage}/${entityName?uncap_first}/add',
|
||||
edit='/${entityPackage}/${entityName?uncap_first}/edit',
|
||||
delete${entityName} = '/sys/${entityName?uncap_first}/delete',
|
||||
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
|
||||
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
|
||||
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
|
||||
loadTreeData = '/${entityPackage}/${entityName?uncap_first}/loadTreeRoot',
|
||||
getChildList = '/${entityPackage}/${entityName?uncap_first}/childList',
|
||||
getChildListBatch = '/${entityPackage}/${entityName?uncap_first}/getChildListBatch',
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
/**
|
||||
* 导入api
|
||||
* @param params
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
export const delete${entityName} = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.delete${entityName}, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete${entityName} = (params, handleSuccess) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdateDict = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
/**
|
||||
* 查询全部树形节点数据
|
||||
* @param params
|
||||
*/
|
||||
export const loadTreeData = (params) =>
|
||||
defHttp.get({url: Api.loadTreeData,params});
|
||||
/**
|
||||
* 查询子节点数据
|
||||
* @param params
|
||||
*/
|
||||
export const getChildList = (params) =>
|
||||
defHttp.get({url: Api.getChildList, params});
|
||||
/**
|
||||
* 批量查询子节点数据
|
||||
* @param params
|
||||
*/
|
||||
export const getChildListBatch = (params) =>
|
||||
defHttp.get({url: Api.getChildListBatch, params},{isTransformResponse:false});
|
@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm"/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref} from 'vue';
|
||||
import {BasicModal, useModalInner} from '/src/components/Modal';
|
||||
import {BasicForm, useForm} from '/src/components/Form';
|
||||
import {formSchema} from '../${entityName?uncap_first}.data';
|
||||
import {loadTreeData, saveOrUpdateDict} from '../${entityName?uncap_first}.api';
|
||||
// 获取emit
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const expandedRowKeys = ref([]);
|
||||
const treeData = ref([]);
|
||||
//表单配置
|
||||
const [registerForm, {resetFields, setFieldsValue, validate, updateSchema}] = useForm({
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 4 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 },
|
||||
},
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
expandedRowKeys.value = [];
|
||||
setModalProps({confirmLoading: false, minHeight: 80});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (data?.record) {
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
}
|
||||
//父级节点树信息
|
||||
treeData.value = await loadTreeData({'async': false,'pcode':''});
|
||||
updateSchema({
|
||||
field: 'pid',
|
||||
componentProps: {treeData},
|
||||
});
|
||||
});
|
||||
//设置标题
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增字典' : '编辑字典'));
|
||||
|
||||
/**
|
||||
* 根据pid获取展开的节点
|
||||
* @param pid
|
||||
* @param arr
|
||||
*/
|
||||
function getExpandKeysByPid(pid,arr){
|
||||
if(pid && arr && arr.length>0){
|
||||
for(let i=0;i<arr.length;i++){
|
||||
if(arr[i].key==pid && unref(expandedRowKeys).indexOf(pid)<0){
|
||||
expandedRowKeys.value.push(arr[i].key);
|
||||
getExpandKeysByPid(arr[i]['parentId'],unref(treeData))
|
||||
}else{
|
||||
getExpandKeysByPid(pid,arr[i].children)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//表单提交事件
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let values = await validate();
|
||||
setModalProps({confirmLoading: true});
|
||||
//提交表单
|
||||
await saveOrUpdateDict(values, isUpdate.value);
|
||||
//关闭弹窗
|
||||
closeModal();
|
||||
//展开的节点信息
|
||||
await getExpandKeysByPid(values['pid'],unref(treeData))
|
||||
//刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息)
|
||||
emit('success', {isUpdate: unref(isUpdate), values:{...values},expandedArr: unref(expandedRowKeys).reverse()});
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<div class="p-4">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :customRequest="(file)=>handleImportXls(file,getImportUrl,importSuccess)">
|
||||
<a-button type="primary" preIcon="ant-design:import-outlined">导入</a-button>
|
||||
</a-upload>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="handleExportXls('${tableVo.ftlDescription}管理',getExportUrl)"> 导出</a-button>
|
||||
|
||||
<a-dropdown v-if="checkedKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作
|
||||
<Icon icon="ant-design:down-outlined"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)"/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!--字典弹窗-->
|
||||
<${entityName}Modal @register="registerModal" @success="handleSuccess"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
//ts语法
|
||||
import {ref, computed, unref, toRaw, nextTick} from 'vue';
|
||||
import {BasicTable, useTable, TableAction} from '/src/components/Table';
|
||||
import {useDrawer} from '/src/components/Drawer';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue';
|
||||
import {useModal} from '/src/components/Modal';
|
||||
import {useMethods} from '/src/hooks/system/useMethods';
|
||||
import {columns} from './${entityName}.data';
|
||||
import {list, delete${entityName}, batchDelete${entityName}, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './${entityName}.api';
|
||||
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const expandedRowKeys = ref([]);
|
||||
const {handleExportXls,handleImportXls} = useMethods();
|
||||
//字典model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const [registerTable, {reload, collapseAll, updateTableDataRecord, findTableDataRecord,getDataSource}] = useTable({
|
||||
api: list,
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
striped: true,
|
||||
useSearchForm: false,
|
||||
showTableSetting: true,
|
||||
clickToRowSelect: false,
|
||||
bordered: true,
|
||||
showIndexColumn: false,
|
||||
tableSetting: {fullScreen: true},
|
||||
canResize: false,
|
||||
actionColumn: {
|
||||
width: 80,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: {customRender: 'action'},
|
||||
fixed: undefined,
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* 选择列配置
|
||||
*/
|
||||
const rowSelection = {
|
||||
type: 'checkbox',
|
||||
columnWidth: 10,
|
||||
selectedRowKeys: checkedKeys,
|
||||
onChange: onSelectChange
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择事件
|
||||
*/
|
||||
function onSelectChange(selectedRowKeys: (string | number)[]) {
|
||||
checkedKeys.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleCreate() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
async function handleEdit(record) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
async function handleDetail(record) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
hideFooter: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await delete${entityName}({id: record.id}, importSuccess);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
const ids = checkedKeys.value.filter(item => !item.includes('loading'))
|
||||
await batchDelete${entityName}({ids: ids}, importSuccess);
|
||||
}
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
function importSuccess() {
|
||||
reload() && (expandedRowKeys.value = []);
|
||||
}
|
||||
/**
|
||||
* 添加下级
|
||||
*/
|
||||
function handleAddSub(record) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
async function handleSuccess({isUpdate, values, expandedArr}) {
|
||||
if (isUpdate) {
|
||||
//编辑回调
|
||||
updateTableDataRecord(values.id, values);
|
||||
} else {
|
||||
if(!values['pid']){
|
||||
//新增根节点
|
||||
reload();
|
||||
}else{
|
||||
//新增子集
|
||||
expandedRowKeys.value = [];
|
||||
for (let key of unref(expandedArr)) {
|
||||
await expandTreeNode(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口请求成功后回调
|
||||
*/
|
||||
function onFetchSuccess(result) {
|
||||
getDataByResult(result.items)&&loadDataByExpandedRows();
|
||||
}
|
||||
/**
|
||||
* 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
|
||||
*/
|
||||
async function loadDataByExpandedRows() {
|
||||
if (unref(expandedRowKeys).length > 0) {
|
||||
const res = await getChildListBatch({ parentIds: unref(expandedRowKeys).join(',')});
|
||||
if (res.success && res.result.records.length>0) {
|
||||
//已展开的数据批量子节点
|
||||
let records = res.result.records
|
||||
const listMap = new Map();
|
||||
for (let item of records) {
|
||||
let pid = item['pid'];
|
||||
if (unref(expandedRowKeys).includes(pid)) {
|
||||
let mapList = listMap.get(pid);
|
||||
if (mapList == null) {
|
||||
mapList = [];
|
||||
}
|
||||
mapList.push(item);
|
||||
listMap.set(pid, mapList);
|
||||
}
|
||||
}
|
||||
let childrenMap = listMap;
|
||||
let fn = (list) => {
|
||||
if(list) {
|
||||
list.forEach(data => {
|
||||
if (unref(expandedRowKeys).includes(data.id)) {
|
||||
data.children = getDataByResult(childrenMap.get(data.id))
|
||||
fn(data.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
fn(getDataSource())
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 处理数据集
|
||||
*/
|
||||
function getDataByResult(result){
|
||||
if(result && result.length>0){
|
||||
return result.map(item=>{
|
||||
//判断是否标记了带有子节点
|
||||
if(item["hasChild"]=='1'){
|
||||
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
|
||||
item.children = [loadChild]
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
*树节点展开合并
|
||||
* */
|
||||
async function handleExpand(expanded, record) {
|
||||
// 判断是否是展开状态,展开状态(expanded)并且存在子集(children)并且未加载过(isLoading)的就去查询子节点数据
|
||||
if (expanded) {
|
||||
expandedRowKeys.value.push(record.id)
|
||||
if (record.children.length > 0 && !!record.children[0].isLoading) {
|
||||
let result = await getChildList({pid: record.id});
|
||||
result=result.records?result.records:result;
|
||||
if (result && result.length > 0) {
|
||||
record.children = getDataByResult(result);
|
||||
} else {
|
||||
record.children = null
|
||||
record.hasChild = '0'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let keyIndex = expandedRowKeys.value.indexOf(record.id)
|
||||
if (keyIndex >= 0) {
|
||||
expandedRowKeys.value.splice(keyIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*操作表格后处理树节点展开合并
|
||||
* */
|
||||
async function expandTreeNode(key) {
|
||||
let record = findTableDataRecord(key)
|
||||
expandedRowKeys.value.push(key);
|
||||
let result = await getChildList({pid: key});
|
||||
if (result && result.length > 0) {
|
||||
record.children = getDataByResult(result);
|
||||
} else {
|
||||
record.children = null
|
||||
record.hasChild = '0'
|
||||
}
|
||||
updateTableDataRecord(key, record);
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '添加下级',
|
||||
onClick: handleAddSub.bind(null, {pid: record.id}),
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<ExcelButton :config="excelConfig"></ExcelButton>
|
||||
<a-dropdown v-if="checkedKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button>批量操作
|
||||
<Icon icon="mdi:chevron-down"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{text}">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template #fileSlot="{text}">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, computed, unref} from 'vue';
|
||||
import {BasicTable, useTable, TableAction} from '/@/components/Table';
|
||||
import ExcelButton from '/@/components/jeecg/ExcelButton.vue'
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue'
|
||||
import {columns, searchFormSchema} from './${entityName?uncap_first}.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName?uncap_first}.api';
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '/@/api/common/api'
|
||||
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
||||
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
|
||||
</#if>
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const [registerTable, {reload}] = useTable({
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
rowKey: 'id',
|
||||
columns,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToTime: [
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#if po.queryMode!='single'>
|
||||
<#if po.classType=='date'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end'], 'YYYY-MM-DD'],
|
||||
<#elseif po.classType=='datetime'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end'], 'YYYY-MM-DD HH:mm:ss'],
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
],
|
||||
},
|
||||
striped: true,
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
clickToRowSelect: false,
|
||||
bordered: true,
|
||||
showIndexColumn: false,
|
||||
tableSetting: {fullScreen: true},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: {customRender: 'action'},
|
||||
fixed: 'right',
|
||||
},
|
||||
})
|
||||
/**
|
||||
* excel导入导出配置
|
||||
*/
|
||||
const excelConfig = {
|
||||
export: {
|
||||
name:'${tableVo.ftlDescription}',
|
||||
url: getExportUrl,
|
||||
},
|
||||
import: {
|
||||
url: getImportUrl,
|
||||
success: reload,
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 选择列配置
|
||||
*/
|
||||
const rowSelection = {
|
||||
type: 'checkbox',
|
||||
columnWidth: 30,
|
||||
selectedRowKeys: checkedKeys,
|
||||
onChange: onSelectChange
|
||||
}
|
||||
/**
|
||||
* 选择事件
|
||||
*/
|
||||
function onSelectChange(selectedRowKeys: (string | number)[]) {
|
||||
checkedKeys.value = selectedRowKeys;
|
||||
}
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
openModal(true, {
|
||||
isUpdate: false,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: true,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({id: record.id}, reload);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: checkedKeys.value}, reload);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
<#if list_need_category>
|
||||
/**
|
||||
* 初始化字典配置
|
||||
*/
|
||||
function initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:'${po.dictField?default("")}'}).then((res) => {
|
||||
if (res) {
|
||||
let allDictDate = getAuthCache(DB_DICT_DATA_KEY);
|
||||
if(!allDictDate['${po.dictField?default("")}']){
|
||||
Object.assign(allDictDate,{'${po.dictField?default("")}':res})
|
||||
}
|
||||
setAuthCache(DB_DICT_DATA_KEY,allDictDate)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
initDictConfig();
|
||||
</#if>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,72 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import {Modal} from 'ant-design-vue';
|
||||
|
||||
enum Api {
|
||||
list = '/${entityPackage}/${entityName?uncap_first}/list',
|
||||
save='/${entityPackage}/${entityName?uncap_first}/add',
|
||||
edit='/${entityPackage}/${entityName?uncap_first}/edit',
|
||||
deleteOne = '/${entityPackage}/${entityName?uncap_first}/delete',
|
||||
deleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch',
|
||||
importExcel = '/${entityPackage}/${entityName?uncap_first}/importExcel',
|
||||
exportXls = '/${entityPackage}/${entityName?uncap_first}/exportXls',
|
||||
<#list subTables as sub><#rt/>
|
||||
${sub.entityName?uncap_first}List = '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId',
|
||||
</#list>
|
||||
}
|
||||
/**
|
||||
* 导出api
|
||||
* @param params
|
||||
*/
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
/**
|
||||
* 导入api
|
||||
*/
|
||||
export const getImportUrl = Api.importExcel;
|
||||
<#list subTables as sub><#rt/>
|
||||
/**
|
||||
* 查询子表数据
|
||||
* @param params
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}List = Api.${sub.entityName?uncap_first}List;
|
||||
</#list>
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) =>
|
||||
defHttp.get({url: Api.list, params});
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType=='1'>
|
||||
#segment#${sub.entityName}Form.vue
|
||||
<template>
|
||||
<BasicForm @register="registerForm"/>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue';
|
||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
||||
import {${sub.entityName?uncap_first}FormSchema} from '../${entityName?uncap_first}.data';
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
|
||||
|
||||
export default defineComponent({
|
||||
name:"${sub.entityName}Form",
|
||||
components: {BasicForm},
|
||||
emits:['register'],
|
||||
setup(_,{emit}) {
|
||||
const [registerForm, {resetFields, setFieldsValue,getFieldsValue,validate}] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: ${sub.entityName?uncap_first}FormSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
/**
|
||||
*初始化加载数据
|
||||
*/
|
||||
function initFormData(url,id){
|
||||
if(id){
|
||||
defHttp.get({url,params:{id}},{isTransformResponse:false}).then(res=>{
|
||||
res.success && setFieldsValue({...res.result[0]});
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
*获取表单数据
|
||||
*/
|
||||
function getFormData(){
|
||||
return [getFieldsValue()];
|
||||
}
|
||||
/**
|
||||
*表单校验
|
||||
*/
|
||||
function validateForm(index){
|
||||
return new Promise((resolve, reject) => {
|
||||
// 验证子表表单
|
||||
validate().then(()=>{
|
||||
return resolve()
|
||||
}).catch(()=> {
|
||||
return reject({ error: VALIDATE_FAILED ,index})
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
registerForm,
|
||||
resetFields,
|
||||
initFormData,
|
||||
getFormData,
|
||||
validateForm
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</#if>
|
||||
</#list>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue