mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-05 01:55:29 +08:00
后台目录结构大调整,让结构更清晰
This commit is contained in:
@ -0,0 +1,297 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,httptrace
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
initialize-schema: embedded
|
||||
#定时任务启动开关,true-开 false-关
|
||||
auto-startup: true
|
||||
#延迟1秒启动定时任务
|
||||
startup-delay: 1s
|
||||
#启动时更新己存在的Job
|
||||
overwrite-existing-jobs: true
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: MyScheduler
|
||||
instanceId: AUTO
|
||||
jobStore:
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
tablePrefix: QRTZ_
|
||||
isClustered: true
|
||||
misfireThreshold: 12000
|
||||
clusterCheckinInterval: 15000
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
#json 时间戳统一转换
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
jpa:
|
||||
open-in-view: false
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
#配置freemarker
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
# 设置文档类型
|
||||
content-type: text/html
|
||||
# 设置页面编码格式
|
||||
charset: UTF-8
|
||||
# 设置页面缓存
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
# 设置ftl文件路径
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
#Spring Boot 2.6+后映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser,需要手动指定为ant-path-matcher
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,slf4j
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
#username: root
|
||||
#password: root
|
||||
#driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: ''
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
configuration:
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 返回类型为Map,显示null对应的字段
|
||||
call-setters-on-nulls: true
|
||||
#jeecg专用配置
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*
|
||||
jeecg:
|
||||
# 是否启用安全模式
|
||||
safeMode: false
|
||||
# 签名密钥串(前后端要一致,正式发布请自行修改)
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
# 签名拦截接口
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
|
||||
#local、minio、alioss
|
||||
uploadType: local
|
||||
# 前端访问地址
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
app: http://localhost:8051
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: /opt/upFiles
|
||||
#webapp文件路径
|
||||
webapp: /opt/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
bucketName: jeecgdev
|
||||
# ElasticSearch 6设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: false
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: 127.0.0.1:8012
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: dev
|
||||
#数据字典是否进行saas数据隔离,自己看自己的字典
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: true
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
address: 127.0.0.1:30007
|
||||
ip: 127.0.0.1
|
||||
port: 30007
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper: info
|
||||
#swagger
|
||||
knife4j:
|
||||
#开启增强配置
|
||||
enable: true
|
||||
#开启生产环境屏蔽
|
||||
production: false
|
||||
basic:
|
||||
enable: false
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
#第三方登录
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
#第三方APP对接
|
||||
third-app:
|
||||
enabled: false
|
||||
type:
|
||||
#企业微信
|
||||
WECHAT_ENTERPRISE:
|
||||
enabled: false
|
||||
#CORP_ID
|
||||
client-id: ??
|
||||
#SECRET
|
||||
client-secret: ??
|
||||
#自建应用id
|
||||
agent-id: ??
|
||||
#自建应用秘钥(新版企微需要配置)
|
||||
# agent-app-secret: ??
|
||||
#钉钉
|
||||
DINGTALK:
|
||||
enabled: false
|
||||
# appKey
|
||||
client-id: ??
|
||||
# appSecret
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
@ -0,0 +1,239 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,httptrace
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
jdbc:
|
||||
initialize-schema: never
|
||||
auto-startup: true
|
||||
#启动时更新己存在的Job
|
||||
overwrite-existing-jobs: true
|
||||
#json 时间戳统一转换
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
jpa:
|
||||
open-in-view: false
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.Oracle8iDialect
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
#配置freemarker
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
# 设置文档类型
|
||||
content-type: text/html
|
||||
# 设置页面编码格式
|
||||
charset: UTF-8
|
||||
# 设置页面缓存
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
# 设置ftl文件路径
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
druid:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 5
|
||||
# 最大连接池数量
|
||||
maxActive: 10
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
driverClassName: dm.jdbc.driver.DmDriver
|
||||
url: jdbc:dm://127.0.0.1:5236/?JEECG&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
|
||||
username: ??
|
||||
password: ??
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: ''
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
configuration:
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 返回类型为Map,显示null对应的字段
|
||||
call-setters-on-nulls: true
|
||||
#jeecg专用配置
|
||||
jeecg:
|
||||
# 是否启用安全模式
|
||||
safeMode: false
|
||||
# 签名密钥串(前后端要一致,正式发布请自行修改)
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
# 本地:local\Minio:minio\阿里云:alioss
|
||||
uploadType: alioss
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: D://opt//upFiles
|
||||
#webapp文件路径
|
||||
webapp: D://opt//webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
bucketName: ??
|
||||
# ElasticSearch 6设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: false
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: 127.0.0.1:8012
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: dev
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
address: 127.0.0.1:30007
|
||||
ip: 127.0.0.1
|
||||
port: 30007
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper: info
|
||||
#enable swagger
|
||||
swagger:
|
||||
enable: true
|
||||
production: false
|
||||
basic:
|
||||
enable: false
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
#第三方登录
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: 1000002
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
#第三方APP对接
|
||||
third-app:
|
||||
enabled: true
|
||||
type:
|
||||
#企业微信
|
||||
WECHAT_ENTERPRISE:
|
||||
enabled: true
|
||||
#CORP_ID
|
||||
client-id: ??
|
||||
#SECRET
|
||||
client-secret: ??-ij8
|
||||
#自建应用id
|
||||
agent-id: 1000004
|
||||
#自建应用秘钥(新版企微需要配置)
|
||||
agent-app-secret: ??
|
||||
#钉钉
|
||||
DINGTALK:
|
||||
enabled: false
|
||||
# appKey
|
||||
client-id: ??
|
||||
# appSecret
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
@ -0,0 +1,298 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,httptrace
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
initialize-schema: embedded
|
||||
#定时任务启动开关,true-开 false-关
|
||||
auto-startup: true
|
||||
#延迟1秒启动定时任务
|
||||
startup-delay: 1s
|
||||
#启动时更新己存在的Job
|
||||
overwrite-existing-jobs: true
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: MyScheduler
|
||||
instanceId: AUTO
|
||||
jobStore:
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
tablePrefix: QRTZ_
|
||||
isClustered: true
|
||||
misfireThreshold: 12000
|
||||
clusterCheckinInterval: 15000
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
#json 时间戳统一转换
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
jpa:
|
||||
open-in-view: false
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
#配置freemarker
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
# 设置文档类型
|
||||
content-type: text/html
|
||||
# 设置页面编码格式
|
||||
charset: UTF-8
|
||||
# 设置页面缓存
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
# 设置ftl文件路径
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
#Spring Boot 2.6+后映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser,需要手动指定为ant-path-matcher
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 1000
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,slf4j
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
#username: root
|
||||
#password: root
|
||||
#driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: ''
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
configuration:
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 返回类型为Map,显示null对应的字段
|
||||
call-setters-on-nulls: true
|
||||
#jeecg专用配置
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*
|
||||
jeecg:
|
||||
# 是否启用安全模式
|
||||
safeMode: false
|
||||
# 签名密钥串(前后端要一致,正式发布请自行修改)
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
# 签名拦截接口
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
|
||||
#local\minio\alioss
|
||||
uploadType: alioss
|
||||
# 前端访问地址
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
app: http://localhost:8051
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: /opt/jeecg-boot/upload
|
||||
#webapp文件路径
|
||||
webapp: /opt/jeecg-boot/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
bucketName: jeecgdev
|
||||
staticDomain: https://static.jeecg.com
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: true
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://fileview.jeecg.com
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: prod
|
||||
#数据字典是否进行saas数据隔离,自己看自己的字典
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: true
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
address: 127.0.0.1:30007
|
||||
ip: 127.0.0.1
|
||||
port: 30007
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper: info
|
||||
#swagger
|
||||
knife4j:
|
||||
#开启增强配置
|
||||
enable: true
|
||||
#开启生产环境屏蔽
|
||||
production: false
|
||||
basic:
|
||||
enable: true
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
#第三方登录
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
#第三方APP对接
|
||||
third-app:
|
||||
enabled: false
|
||||
type:
|
||||
#企业微信
|
||||
WECHAT_ENTERPRISE:
|
||||
enabled: false
|
||||
#CORP_ID
|
||||
client-id: ??
|
||||
#SECRET
|
||||
client-secret: ??
|
||||
#自建应用id
|
||||
agent-id: ??
|
||||
#自建应用秘钥(新版企微需要配置)
|
||||
# agent-app-secret: ??
|
||||
#钉钉
|
||||
DINGTALK:
|
||||
enabled: false
|
||||
# appKey
|
||||
client-id: ??
|
||||
# appSecret
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
@ -0,0 +1,298 @@
|
||||
server:
|
||||
port: 8080
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
servlet:
|
||||
context-path: /jeecg-boot
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,httptrace
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
initialize-schema: embedded
|
||||
#定时任务启动开关,true-开 false-关
|
||||
auto-startup: true
|
||||
#延迟1秒启动定时任务
|
||||
startup-delay: 1s
|
||||
#启动时更新己存在的Job
|
||||
overwrite-existing-jobs: true
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: MyScheduler
|
||||
instanceId: AUTO
|
||||
jobStore:
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
tablePrefix: QRTZ_
|
||||
isClustered: true
|
||||
misfireThreshold: 12000
|
||||
clusterCheckinInterval: 15000
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
#json 时间戳统一转换
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
jpa:
|
||||
open-in-view: false
|
||||
#配置freemarker
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
# 设置文档类型
|
||||
content-type: text/html
|
||||
# 设置页面编码格式
|
||||
charset: UTF-8
|
||||
# 设置页面缓存
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
# 设置ftl文件路径
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
#Spring Boot 2.6+后映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser,需要手动指定为ant-path-matcher
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,slf4j
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
#username: root
|
||||
#password: root
|
||||
#driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: 192.168.1.199
|
||||
port: 6379
|
||||
password: ''
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
configuration:
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 返回类型为Map,显示null对应的字段
|
||||
call-setters-on-nulls: true
|
||||
#jeecg专用配置
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*
|
||||
jeecg:
|
||||
# 是否启用安全模式
|
||||
safeMode: false
|
||||
# 签名密钥串(前后端要一致,正式发布请自行修改)
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
# 签名拦截接口
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
|
||||
# local\minio\alioss
|
||||
uploadType: local
|
||||
# 前端访问地址
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
app: http://localhost:8051
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: D://opt//upFiles
|
||||
#webapp文件路径
|
||||
webapp: D://opt//webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
bucketName: jeecgdev
|
||||
staticDomain: https://static.jeecg.com
|
||||
# ElasticSearch 设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 81.70.47.128:9200
|
||||
check-enabled: false
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://127.0.0.1:8012
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: ??
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
mode: prod
|
||||
#数据字典是否进行saas数据隔离,自己看自己的字典
|
||||
saas: false
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
address: 127.0.0.1:30007
|
||||
ip: 127.0.0.1
|
||||
port: 30007
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper: info
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#swagger
|
||||
knife4j:
|
||||
#开启增强配置
|
||||
enable: true
|
||||
#开启生产环境屏蔽
|
||||
production: false
|
||||
basic:
|
||||
enable: true
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
#第三方登录
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
#第三方APP对接
|
||||
third-app:
|
||||
enabled: false
|
||||
type:
|
||||
#企业微信
|
||||
WECHAT_ENTERPRISE:
|
||||
enabled: false
|
||||
#CORP_ID
|
||||
client-id: ??
|
||||
#SECRET
|
||||
client-secret: ??
|
||||
#自建应用id
|
||||
agent-id: ??
|
||||
#自建应用秘钥(新版企微需要配置)
|
||||
# agent-app-secret: ??
|
||||
#钉钉
|
||||
DINGTALK:
|
||||
enabled: false
|
||||
# appKey
|
||||
client-id: ??
|
||||
# appSecret
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
@ -0,0 +1,5 @@
|
||||
spring:
|
||||
application:
|
||||
name: jeecg-system
|
||||
profiles:
|
||||
active: '@profile.name@'
|
||||
@ -0,0 +1,14 @@
|
||||
${AnsiColor.BRIGHT_BLUE}
|
||||
(_) | | | |
|
||||
_ ___ ___ ___ __ _ ______| |__ ___ ___ | |_
|
||||
| |/ _ \/ _ \/ __/ _` |______| '_ \ / _ \ / _ \| __|
|
||||
| | __/ __/ (_| (_| | | |_) | (_) | (_) | |_
|
||||
| |\___|\___|\___\__, | |_.__/ \___/ \___/ \__|
|
||||
_/ | __/ |
|
||||
|__/ |___/
|
||||
|
||||
|
||||
${AnsiColor.BRIGHT_GREEN}
|
||||
Jeecg Boot Version: 3.4.0
|
||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||
${AnsiColor.BLACK}
|
||||
@ -0,0 +1,32 @@
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
private byte[] ${po.fieldName};
|
||||
|
||||
public byte[] get${po.fieldName?cap_first}(){
|
||||
if(${po.fieldName}String==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return ${po.fieldName}String.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get${po.fieldName?cap_first}String(){
|
||||
if(${po.fieldName}==null || ${po.fieldName}.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(${po.fieldName},"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
<#else>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
@ -0,0 +1,48 @@
|
||||
<#if need_select_tag>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if need_switch>
|
||||
JSwitch,
|
||||
</#if>
|
||||
<#if need_multi>
|
||||
JSelectMultiple,
|
||||
</#if>
|
||||
<#if need_search>
|
||||
JSearchSelect,
|
||||
</#if>
|
||||
<#if need_popup>
|
||||
JPopup,
|
||||
</#if>
|
||||
<#if need_category>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if need_dept>
|
||||
JSelectDept,
|
||||
</#if>
|
||||
<#if need_dept_user>
|
||||
JSelectUserByDept,
|
||||
</#if>
|
||||
<#if need_select_tree>
|
||||
JTreeSelect,
|
||||
</#if>
|
||||
<#if need_time>
|
||||
TimePicker,
|
||||
</#if>
|
||||
<#if need_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if need_upload>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if need_image_upload>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if need_markdown>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if need_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if need_checkbox>
|
||||
JCheckbox,
|
||||
</#if>
|
||||
@ -0,0 +1,107 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id' && isNotPidField(tableVo, po.fieldDbName)>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" v-bind="validateInfos.${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<a-date-picker placeholder="请选择${po.filedComment}" v-model:value="formData.${po.fieldName}" value-format="YYYY-MM-DD" style="width: 100%" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<a-date-picker placeholder="请选择${po.filedComment}" v-model:value="formData.${po.fieldName}" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<#assign need_time = true>
|
||||
<time-picker placeholder="请选择${po.filedComment}" value-format="HH:mm:ss" v-model:value="formData.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign need_popup = true>
|
||||
<#assign sourceFields = po.dictField?default("")?trim?split(",")/>
|
||||
<#assign targetFields = po.dictText?default("")?trim?split(",")/>
|
||||
<j-popup
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model:value="formData.${po.fieldName}"
|
||||
code="${po.dictTable}"
|
||||
:fieldConfig="[
|
||||
<#list sourceFields as fieldName>
|
||||
{ source: '${fieldName}', target: '${targetFields[fieldName_index]}' },
|
||||
</#list>
|
||||
]"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
:setFieldsValue="setFieldsValue"
|
||||
<#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if><#rt>
|
||||
/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign need_dept = true>
|
||||
<j-select-dept v-model:value="formData.${po.fieldName}" :multiple="${po.extendParams.multi?default('true')}" checkStrictly <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign need_switch = true>
|
||||
<j-switch v-model:value="formData.${po.fieldName}" <#if po.dictField != 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign need_pca = true>
|
||||
<j-area-linkage v-model:value="formData.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> />
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign need_markdown = true>
|
||||
<j-markdown-editor v-model:value="formData.${autoStringSuffixForModel(po)}" id="${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model:value="formData.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign need_dept_user = true>
|
||||
<j-select-user-by-dept v-model:value="formData.${po.fieldName}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model:value="formData.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType=='radio'>
|
||||
<#assign need_select_tag = true>
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType=='list'>
|
||||
<#assign need_select_tag = true>
|
||||
<j-dict-select-tag v-model:value="formData.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#assign need_multi = true>
|
||||
<j-select-multiple type="${po.classType}" v-model:value="formData.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> :triggerChange="false"/>
|
||||
<#elseif po.classType=='checkbox'>
|
||||
<#assign need_checkbox = true>
|
||||
<j-checkbox type="${po.classType}" v-model:value="formData.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign need_search = true>
|
||||
<j-search-select v-model:value="formData.${po.fieldName}" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign need_category = true>
|
||||
<j-category-select v-model:value="formData.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}"</#if> <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> @change="(value) => handleFormChange('${po.fieldName}', value)" />
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model:value="formData.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign need_upload = true>
|
||||
<j-upload v-model:value="formData.${po.fieldName}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if> <#if po.uploadnum??>:maxCount=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign need_image_upload = true>
|
||||
<j-image-upload <#if po.uploadnum??>:fileMax=${po.uploadnum}</#if> v-model:value="formData.${po.fieldName}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign need_editor = true>
|
||||
<j-editor v-model:value="formData.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model:value="formData.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>></a-input>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<#assign need_select_tree = true>
|
||||
<j-tree-select
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}"
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField="${po.dictText?split(',')[1]}"
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField="${po.dictText?split(',')[3]}"
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue="${po.dictField}"
|
||||
<#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>
|
||||
v-model:value="formData.${po.fieldName}"
|
||||
@change="(value) => handleFormChange('${po.fieldName}', value)">
|
||||
</j-tree-select>
|
||||
<#else>
|
||||
<a-input v-model:value="formData.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
@ -0,0 +1,48 @@
|
||||
<#if need_select_tag>
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
</#if>
|
||||
<#if need_switch>
|
||||
import JSwitch from '/@/components/Form/src/jeecg/components/JSwitch.vue';
|
||||
</#if>
|
||||
<#if need_multi>
|
||||
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||
</#if>
|
||||
<#if need_search>
|
||||
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
|
||||
</#if>
|
||||
<#if need_popup>
|
||||
import JPopup from '/@/components/Form/src/jeecg/components/JPopup.vue';
|
||||
</#if>
|
||||
<#if need_category>
|
||||
import JCategorySelect from '/@/components/Form/src/jeecg/components/JCategorySelect.vue';
|
||||
</#if>
|
||||
<#if need_dept>
|
||||
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
|
||||
</#if>
|
||||
<#if need_dept_user>
|
||||
import JSelectUserByDept from '/@/components/Form/src/jeecg/components/JSelectUserByDept.vue';
|
||||
</#if>
|
||||
<#if need_select_tree>
|
||||
import JTreeSelect from '/@/components/Form/src/jeecg/components/JTreeSelect.vue';
|
||||
</#if>
|
||||
<#if need_time>
|
||||
import { TimePicker } from 'ant-design-vue';
|
||||
</#if>
|
||||
<#if need_pca>
|
||||
import JAreaLinkage from '/@/components/Form/src/jeecg/components/JAreaLinkage.vue';
|
||||
</#if>
|
||||
<#if need_upload>
|
||||
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
||||
</#if>
|
||||
<#if need_image_upload>
|
||||
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
|
||||
</#if>
|
||||
<#if need_markdown>
|
||||
import JMarkdownEditor from '/@/components/Form/src/jeecg/components/JMarkdownEditor.vue';
|
||||
</#if>
|
||||
<#if need_editor>
|
||||
import JEditor from '/@/components/Form/src/jeecg/components/JEditor.vue';
|
||||
</#if>
|
||||
<#if need_checkbox>
|
||||
import JCheckbox from "/@/components/Form/src/jeecg/components/JCheckbox.vue";
|
||||
</#if>
|
||||
@ -0,0 +1,85 @@
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign need_select_tag = true>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign need_select_tag = true>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :lg="8">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}" />
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dept placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
|
||||
<#elseif po.classType=='switch'>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query />
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-dept placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" checkStrictly />
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-select-multiple placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model:value="queryParam.${po.fieldName}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}" @change="(value) => handleFormChange('${po.fieldName}', value)" />
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker valueFormat="YYYY-MM-DD" placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage v-model:value="queryParam.${po.fieldName}" placeholder="请选择${po.filedComment}" @change="(value) => handleAreaChange('${po.fieldName}', value)" />
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-tree-select v-model:value="queryParam.${po.fieldName}" placeholder="请选择${po.filedComment}" <#if po.dictText??><#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}" <#elseif po.dictText?split(',')[1]??>pidField:"${po.dictText?split(',')[1]}", <#elseif po.dictText?split(',')[3]??>hasChildField:"${po.dictText?split(',')[3]}"</#if> </#if>pidValue="${po.dictField}" />
|
||||
<#elseif po.classType=='popup'>
|
||||
<#assign sourceFields = po.dictField?default("")?trim?split(",")/>
|
||||
<#assign targetFields = po.dictText?default("")?trim?split(",")/>
|
||||
<#if query_field_no gt 1> </#if><j-popup
|
||||
<#if query_field_no gt 1> </#if>placeholder="请选择${po.filedComment}"
|
||||
<#if query_field_no gt 1> </#if>v-model:value="queryParam.${po.fieldName}"
|
||||
<#if query_field_no gt 1> </#if>code="${po.dictTable}"
|
||||
<#if query_field_no gt 1> </#if>:fieldConfig="[
|
||||
<#list sourceFields as fieldName>
|
||||
<#if query_field_no gt 1> </#if>{ source: '${fieldName}', target: '${targetFields[fieldName_index]}' },
|
||||
</#list>
|
||||
<#if query_field_no gt 1> </#if>]"
|
||||
<#if query_field_no gt 1> </#if>:multi="${po.extendParams.popupMulti?c}"
|
||||
<#if query_field_no gt 1> </#if>:setFieldsValue="setFieldsValue" />
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :lg="8">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"/>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择结束日期" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"/>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" />
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
|
||||
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" />
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
@ -0,0 +1,13 @@
|
||||
<#assign sourceFields = col.dictField?default("")?trim?split(",")/>
|
||||
<#assign targetFields = col.dictText?default("")?trim?split(",")/>
|
||||
type: JVxeTypes.popup,
|
||||
popupCode:"${col.dictTable}",
|
||||
fieldConfig: [
|
||||
<#list sourceFields as fieldName>
|
||||
{ source: '${fieldName}', target: '${targetFields[fieldName_index]}' },
|
||||
</#list>
|
||||
],
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
<#assign sourceFields = po.dictField?default("")?trim?split(",")/>
|
||||
<#assign targetFields = po.dictText?default("")?trim?split(",")/>
|
||||
component: 'JPopup',
|
||||
componentProps: ({ formActionType }) => {
|
||||
const {setFieldsValue} = formActionType;
|
||||
return{
|
||||
setFieldsValue:setFieldsValue,
|
||||
code:"${po.dictTable}",
|
||||
fieldConfig: [
|
||||
<#list sourceFields as fieldName>
|
||||
{ source: '${fieldName}', target: '${targetFields[fieldName_index]}' },
|
||||
</#list>
|
||||
],
|
||||
multi:${po.extendParams.popupMulti?c}
|
||||
}
|
||||
},
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
<#list columns as po>
|
||||
<#if po.isShow == 'Y'>
|
||||
<#if po.fieldName != 'id'>
|
||||
<#if po.defaultVal??>
|
||||
<#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
|
||||
${po.fieldName}:${po.defaultVal},
|
||||
<#else>
|
||||
${po.fieldName}:"${po.defaultVal}",
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
@ -0,0 +1,13 @@
|
||||
<#list sub.colums as po>
|
||||
<#if po.isShow == 'Y'>
|
||||
<#if po.fieldName != 'id'>
|
||||
<#if po.defaultVal??>
|
||||
<#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
|
||||
${po.fieldName}:${po.defaultVal},
|
||||
<#else>
|
||||
${po.fieldName}:"${po.defaultVal}",
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
@ -0,0 +1,27 @@
|
||||
-- 注意:该页面对应的前台目录为views/${entityPackage}文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
<#assign id = '${.now?string["yyyyMMddhhmmSSsss"]}0'>
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('${id}', NULL, '${tableVo.ftlDescription}', '/${entityPackage}/${entityName?uncap_first}List', '${entityPackage}/${entityName}List', NULL, NULL, 0, NULL, '1', 1.00, 0, NULL, 1, 1, 0, 0, 0, NULL, '1', 0, 0, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0);
|
||||
|
||||
-- 权限控制sql
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}1', '${id}', '添加${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}2', '${id}', '编辑${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}3', '${id}', '删除${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}4', '${id}', '批量删除${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}5', '${id}', '导出excel_${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('${.now?string["yyyyMMddhhmmSSsss"]}6', '${id}', '导入excel_${tableVo.ftlDescription}', NULL, NULL, 0, NULL, NULL, 2, '${bussiPackage}:${tableName}:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '${.now?string["yyyy-MM-dd HH:mm:ss"]}', NULL, NULL, 0, 0, '1', 0);
|
||||
@ -0,0 +1,173 @@
|
||||
<#---->
|
||||
<#-- freemarker 的一些工具方法 -->
|
||||
<#---->
|
||||
<#-- 驼峰转其他字符 -->
|
||||
<#-- @param str 待转换的文本 -->
|
||||
<#-- @param character 要转换成的字符 -->
|
||||
<#-- @param case 转换大小写(normal 不转换,lower 小写,upper 大写) -->
|
||||
<#function camelToChar(str, character, case='normal')>
|
||||
<#assign text=str?replace("([a-z])([A-Z]+)","$1${character}$2","r")/>
|
||||
<#if case=="upper">
|
||||
<#return text?upper_case>
|
||||
<#elseif case=="lower">
|
||||
<#return text?lower_case>
|
||||
<#else>
|
||||
<#return text>
|
||||
</#if>
|
||||
</#function>
|
||||
<#--下划线转驼峰-->
|
||||
<#function dashedToCamel(str)>
|
||||
<#assign text=""/>
|
||||
<#assign strlist = str?split("_")/>
|
||||
<#list strlist as v>
|
||||
<#assign text=text+v?cap_first/>
|
||||
</#list>
|
||||
<#return text?uncap_first>
|
||||
</#function>
|
||||
<#-- 驼峰转下划线 -->
|
||||
<#function camelToDashed(str, case='lower')>
|
||||
<#return camelToChar(str, "_", case)>
|
||||
</#function>
|
||||
<#---->
|
||||
<#-- 驼峰转横线 -->
|
||||
<#function camelToHorizontal(str, case='normal')>
|
||||
<#return camelToChar(str, "-", case)>
|
||||
</#function>
|
||||
<#---->
|
||||
<#-- 获取 v-model 属性 -->
|
||||
<#function getVModel po,suffix="">
|
||||
<#return "v-model=\"queryParam.${po.fieldName}${suffix}\"">
|
||||
</#function>
|
||||
<#-- 获取 placeholder 属性 -->
|
||||
<#function getPlaceholder po,prefix,fillComment=true>
|
||||
<#if fillComment>
|
||||
<#return "placeholder=\"${prefix}${po.filedComment}\"">
|
||||
<#else>
|
||||
<#return "placeholder=\"${prefix}\"">
|
||||
</#if>
|
||||
</#function>
|
||||
<#-- ** 判断某字段是否配置了校验 * -->
|
||||
<#function poHasCheck po>
|
||||
<#if (po.fieldValidType!'')?trim?length gt 0 || po.nullable == 'N'>
|
||||
<#if po.fieldName != 'id'>
|
||||
<#if po.nullable == 'N'
|
||||
|| po.fieldValidType == '*'
|
||||
|| po.fieldValidType == 'only'
|
||||
|| po.fieldValidType == 'n6-16'
|
||||
|| po.fieldValidType == '*6-16'
|
||||
|| po.fieldValidType == 's6-18'
|
||||
|| po.fieldValidType == 'url'
|
||||
|| po.fieldValidType == 'e'
|
||||
|| po.fieldValidType == 'm'
|
||||
|| po.fieldValidType == 'p'
|
||||
|| po.fieldValidType == 's'
|
||||
|| po.fieldValidType == 'n'
|
||||
|| po.fieldValidType == 'z'
|
||||
|| po.fieldValidType == 'money'
|
||||
|| po.fieldValidType != ''
|
||||
>
|
||||
<#return true>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#return false>
|
||||
</#function>
|
||||
<#-- ** 如果配置了校验就显示 validatorRules * -->
|
||||
<#function autoWriteRules po>
|
||||
<#if poHasCheck(po)>
|
||||
<#return ", validatorRules.${po.fieldName}">
|
||||
<#else>
|
||||
<#return "">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#-- ** 如果Blob就显示 String * -->
|
||||
<#function autoStringSuffix po>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
<#return "'${po.fieldName}String'">
|
||||
<#else>
|
||||
<#return "'${po.fieldName}'">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#-- ** 如果Blob就显示model方式 String * -->
|
||||
<#function autoStringSuffixForModel po>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
<#return "${po.fieldName}String">
|
||||
<#else>
|
||||
<#return "${po.fieldName}">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#-- ** 高级查询生成 * -->
|
||||
<#function superQueryFieldList po>
|
||||
<#assign superQuery_dictTable="">
|
||||
<#assign superQuery_dictText="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign superQuery_dictTable="${po.dictTable}">
|
||||
</#if>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign superQuery_dictText="${po.dictText}">
|
||||
</#if>
|
||||
<#if po.classType=="popup">
|
||||
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}', popup:{code:'${po.dictTable}',field:'${po.dictField?split(',')[0]}',orgFields:'${po.dictField?split(',')[0]}',destFields:'${po.dictText?split(',')[0]}'}}">
|
||||
<#elseif po.classType=="sel_user" || po.classType=="sel_depart" || po.classType=="datetime" || po.classType=="date" || po.classType=="pca" || po.classType=="switch">
|
||||
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
|
||||
<#else>
|
||||
<#if po.classType=="sel_search" || po.classType=="list_multi">
|
||||
<#return "{type:'${po.classType}',value:'${po.fieldName}',text:'${po.filedComment}',dictTable:\"${superQuery_dictTable}\", dictText:'${superQuery_dictText}', dictCode:'${po.dictField}'}">
|
||||
<#elseif po.dictTable?? && po.dictTable!="" && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
|
||||
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:\"${po.dictTable},${po.dictText},${po.dictField}\"}">
|
||||
<#elseif po.dictField?? && po.classType!="sel_tree" && po.classType!="cat_tree" && po.classType!="link_down">
|
||||
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}',dictCode:'${po.dictField}'}">
|
||||
<#elseif po.fieldDbType=="Text">
|
||||
<#return "{type:'string',value:'${po.fieldName}',text:'${po.filedComment}'}">
|
||||
<#elseif po.fieldDbType=="Blob">
|
||||
<#return "{type:'byte',value:'${po.fieldName}',text:'${po.filedComment}'}">
|
||||
<#elseif po.fieldDbType=="BigDecimal" || po.fieldDbType=="double">
|
||||
<#return "{type:'number',value:'${po.fieldName}',text:'${po.filedComment}'}">
|
||||
<#else>
|
||||
<#return "{type:'${po.fieldDbType}',value:'${po.fieldName}',text:'${po.filedComment}'}">
|
||||
</#if>
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
|
||||
<#-- vue3 获取表单modal的宽度-->
|
||||
<#function getModalWidth fieldRowNum>
|
||||
<#assign modal_width = 800>
|
||||
<#if fieldRowNum==2>
|
||||
<#assign modal_width = 896>
|
||||
<#elseif fieldRowNum==3>
|
||||
<#assign modal_width = 1024>
|
||||
<#elseif fieldRowNum==4>
|
||||
<#assign modal_width = 1280>
|
||||
</#if>
|
||||
<#return modal_width>
|
||||
</#function>
|
||||
|
||||
<#-- vue3 获取表单 colspan -->
|
||||
<#function getFormSpan fieldRowNum>
|
||||
<#assign form_span = 24>
|
||||
<#if fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#return form_span>
|
||||
</#function>
|
||||
|
||||
<#-- vue3 native 判断字段名不是 pidField -->
|
||||
<#function isNotPidField(tableVo, fieldDbName) >
|
||||
<#assign flag = true>
|
||||
<#if tableVo??>
|
||||
<#if tableVo.extendParams??>
|
||||
<#if tableVo.extendParams.pidField?default("")?trim == fieldDbName>
|
||||
<#assign flag = false>
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#return flag>
|
||||
</#function>
|
||||
@ -0,0 +1,57 @@
|
||||
<#include "../utils.ftl">
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
<#if po.fieldName != 'id'>
|
||||
${po.fieldName}: [
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'},
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{ validator: (rule, value, callback) => validateDuplicateValue(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}', value, this.model.id, callback)},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'},
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
|
||||
<#-- 6到18位字符串 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'},
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!'},
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
],
|
||||
</#if>
|
||||
</#if>
|
||||
@ -0,0 +1,5 @@
|
||||
validatorRules: {
|
||||
<#list columns as po>
|
||||
<#include "core.ftl">
|
||||
</#list>
|
||||
},
|
||||
@ -0,0 +1,49 @@
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'}<#rt>,
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false}<#rt>,
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{ validator: ${po.fieldName}Duplicatevalidate }<#rt>
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'}<#rt>,
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'}<#rt>,
|
||||
<#-- 6到18位字符串 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'}<#rt>,
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'}<#rt>,
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'}<#rt>,
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}<#rt>,
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'}<#rt>,
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'}<#rt>,
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'}<#rt>,
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!'}<#rt>,
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'}<#rt>,
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'}<#rt>,
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
@ -0,0 +1,6 @@
|
||||
<#include "../../utils.ftl">
|
||||
<#list columns as po>
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
${po.fieldName}: [<#include "vue3CoreNative.ftl">],
|
||||
</#if>
|
||||
</#list>
|
||||
@ -0,0 +1,23 @@
|
||||
<#include "../utils.ftl">
|
||||
<#if col.isShow == 'Y' && poHasCheck(col)>
|
||||
validateRules: [
|
||||
<#if col.fieldName != 'id'>
|
||||
<#assign subFieldValidType = col.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if col.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '${'$'}{title}不能为空' },
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 其他情况下,只要有值就被认为是正则校验 -->
|
||||
<#if subFieldValidType?length gt 0>
|
||||
<#assign subMessage = '格式不正确'>
|
||||
<#if subFieldValidType == 'only' >
|
||||
<#assign subMessage = '不能重复'>
|
||||
</#if>
|
||||
{ pattern: "${subFieldValidType}", message: "${'$'}{title}${subMessage}" }
|
||||
<#t>
|
||||
</#if>
|
||||
</#if>
|
||||
],
|
||||
</#if>
|
||||
@ -0,0 +1,5 @@
|
||||
validatorRules: {
|
||||
<#list sub.colums as po>
|
||||
<#include "core.ftl">
|
||||
</#list>
|
||||
},
|
||||
@ -0,0 +1,186 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
//@RequiresPermissions("${bussiPackage}:${tableName}:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
//@RequiresPermissions("${bussiPackage}:${tableName}:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
//@RequiresPermissions("${bussiPackage}:${tableName}:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
//@RequiresPermissions("${bussiPackage}:${tableName}:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
//@RequiresPermissions("${bussiPackage}:${tableName}:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("${tableName}:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
<#include "/common/utils.ftl">
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "${camelToDashed(po.extendParams.text?default(\"realname\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"username\")?trim)}"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
<#-- <#if po.classType!='popup'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}")
|
||||
</#if>
|
||||
</#if>-->
|
||||
</#if>
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
}
|
||||
@ -0,0 +1,426 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=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>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
:scroll="{x:true}"
|
||||
</#if>
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
class="j-table-force-nowrap"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import '@/assets/less/TableExpand.less'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}List',
|
||||
mixins:[JeecgListMixin, mixinDevice],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${dashedToCamel(po.dictText)}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
fixed:"right",
|
||||
width:147,
|
||||
</#if>
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/list",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//代码生成后需手动设置流程编码
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
<#if list_need_pca>
|
||||
pcaData:'',
|
||||
</#if>
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
<#if list_need_switch>
|
||||
<#list columns as po>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
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.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
getSuperFieldList(){
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,267 @@
|
||||
<#--<#include "../../../../../../../common/utils.ftl">-->
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}" <#if po.dictField != 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model="model.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model="model.${po.fieldName}"
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}"
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField="${po.dictText?split(',')[1]}"
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField="${po.dictText?split(',')[3]}"
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue="${po.dictField}"
|
||||
<#if po.readonly=='Y'>disabled</#if>>
|
||||
</j-tree-select>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if> ></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if bpm_flag>
|
||||
<a-col v-if="showFlowSubmitButton" :span="24" style="width: 100%;text-align: center;">
|
||||
<a-button icon="check" style="width: 126px" type="primary" @click="submitForm">提 交</a-button>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</j-form-container>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: '${entityName}Form',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
<#if bpm_flag>
|
||||
//流程表单data
|
||||
formData: {
|
||||
type: Object,
|
||||
default: ()=>{},
|
||||
required: false
|
||||
},
|
||||
//表单模式:true流程表单 false普通表单
|
||||
formBpm: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
},
|
||||
</#if>
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
model:{
|
||||
<#include "/common/init/initValue.ftl">
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById"
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
<#if bpm_flag>
|
||||
if(this.formBpm===true){
|
||||
if(this.formData.disabled===false){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
</#if>
|
||||
return this.disabled
|
||||
},
|
||||
<#if bpm_flag>
|
||||
showFlowSubmitButton(){
|
||||
if(this.formBpm===true){
|
||||
if(this.formData.disabled===false){
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
</#if>
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
<#if bpm_flag>
|
||||
//如果是流程中表单,则需要加载流程表单data
|
||||
this.showFlowData();
|
||||
</#if>
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit(this.modelDefault);
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//渲染流程表单数据
|
||||
showFlowData(){
|
||||
if(this.formBpm === true){
|
||||
let params = {id:this.formData.dataId};
|
||||
getAction(this.url.queryById,params).then((res)=>{
|
||||
if(res.success){
|
||||
this.edit (res.result);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
</#if>
|
||||
submitForm () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(this.model, backObj);
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,70 @@
|
||||
<#--<#include "../../../../../../../common/utils.ftl">-->
|
||||
<#include "/common/utils.ftl">
|
||||
<#assign modal_width = 800>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign modal_width = 896>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign modal_width = 1024>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign modal_width = 1280>
|
||||
</#if>
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></${Format.humpToShortbar(entityName)}-form>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
export default {
|
||||
name: '${entityName}Modal',
|
||||
components: {
|
||||
${entityName}Form
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:'',
|
||||
width:${modal_width},
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,93 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#assign modal_width = 800>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign modal_width = 896>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign modal_width = 1024>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign modal_width = 1280>
|
||||
</#if>
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="false"
|
||||
@close="close"
|
||||
destroyOnClose
|
||||
:visible="visible">
|
||||
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${Format.humpToShortbar(entityName)}-form>
|
||||
<div class="drawer-footer">
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
|
||||
export default {
|
||||
name: '${entityName}Modal',
|
||||
components: {
|
||||
${entityName}Form
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:${modal_width},
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 30px;
|
||||
margin-bottom: 30px;
|
||||
float: right;
|
||||
}
|
||||
.drawer-footer{
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 16px;
|
||||
text-align: right;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,284 @@
|
||||
<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>
|
||||
<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="selectedRowKeys.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 #pcaSlot="{text}">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</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" 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 './components/${entityName}Modal.vue'
|
||||
import {columns, searchFormSchema} from './${entityName}.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
<#if list_need_pca>
|
||||
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
|
||||
</#if>
|
||||
<#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>
|
||||
<#if bpm_flag==true>
|
||||
import { startProcess } from '/@/api/common/api';
|
||||
</#if>
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#if po.queryMode!='single'>
|
||||
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end']],
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
],
|
||||
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>
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed:'right'
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name:"${tableVo.ftlDescription}",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
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}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: selectedRowKeys.value}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
<#if bpm_flag==true>
|
||||
let dropDownAction = [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
];
|
||||
if(record.bpmStatus == '1'){
|
||||
dropDownAction.push({
|
||||
label: '发起流程',
|
||||
popConfirm: {
|
||||
title: '确认提交流程吗?',
|
||||
confirm: handleProcess.bind(null, record),
|
||||
}
|
||||
})
|
||||
}
|
||||
return dropDownAction;
|
||||
<#else>
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
</#if>
|
||||
}
|
||||
|
||||
<#if bpm_flag==true>
|
||||
/**
|
||||
* 提交流程
|
||||
*/
|
||||
async function handleProcess(record) {
|
||||
let params = {
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
await startProcess(params);
|
||||
handleSuccess();
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#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,64 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
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) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
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,376 @@
|
||||
<#include "/common/utils.ftl">
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
{
|
||||
title: '${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:({text}) =>{
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
},
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'htmlSlot' },
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'pcaSlot' },
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'fileSlot' },
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:render.renderImage,
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
customRender:({text}) => {
|
||||
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
},
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictText?default("")?trim?length == 0>
|
||||
customRender:({text}) => {
|
||||
return render.renderCategoryTree(text,'${po.dictField?default("")}')
|
||||
},
|
||||
<#else>
|
||||
customRender: ({text, record}) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#if po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict:"${po.dictTable},${po.dictText},${po.dictField}"
|
||||
},
|
||||
<#elseif po.classType=='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
<#elseif po.classType=='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
query:true,
|
||||
<#if po.dictField != 'is_open'>
|
||||
options:${po.dictField}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType=='list_multi'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictTable},${po.dictText},${po.dictField}",
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictField}",
|
||||
</#if>
|
||||
triggerChange: true
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode:"${po.dictField?default("")}",//back和事件未添加,暂时有问题
|
||||
},
|
||||
<#elseif po.classType=='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime:true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType=='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType=='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
<#else>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='date'>
|
||||
component: 'RangePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
showTime:true
|
||||
},
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'JRangeNumber',
|
||||
<#else>
|
||||
component: 'Input', //TODO 范围查询
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign id_exists = false>
|
||||
<#list columns as po><#rt/>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.fieldDbName == 'id'>
|
||||
<#assign id_exists = true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
{
|
||||
label: '${po.filedComment}',
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
|
||||
<#if po.defaultVal??>
|
||||
<#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
|
||||
defaultValue: ${po.defaultVal},
|
||||
<#else>
|
||||
defaultValue: "${po.defaultVal}",
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
|
||||
<#if po.classType =='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType =='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType =='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options:${po.dictField}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType =='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType =='markdown'>
|
||||
component: 'JMarkdownEditor',//注意string转换问题
|
||||
<#elseif po.classType =='password'>
|
||||
component: 'InputPassword',
|
||||
<#elseif po.classType =='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
componentProps:{
|
||||
labelKey:'realname',
|
||||
},
|
||||
<#elseif po.classType =='textarea'>
|
||||
component: 'InputTextArea',
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
dictCode:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
dictCode:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode:"${po.dictField?default("")}", //TODO back和事件未添加,暂时有问题
|
||||
},
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'InputNumber',
|
||||
<#elseif po.classType=='file'>
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
maxCount:${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='image'>
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
fileMax:${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='umeditor'>
|
||||
component: 'JEditor',
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps:{
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField:"${po.dictText?split(',')[1]}",
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField:"${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue:"${po.dictField}",
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
dynamicRules: ({model,schema}) => {
|
||||
<#if po.fieldName != 'id'>
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
return [
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'},
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'},
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
|
||||
<#-- 6到18位字母 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern: /^[a-z|A-Z]{6,18}$/, message: '请输入6到18位字母!'},
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!'},
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
];
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
<#if po.readonly=='Y'>
|
||||
dynamicDisabled:true
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
<#if id_exists == false>
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
</#if>
|
||||
];
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,67 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" @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}.data';
|
||||
import {saveOrUpdate} from '../${entityName}.api';
|
||||
// Emits声明
|
||||
const emit = defineEmits(['register','success']);
|
||||
const isUpdate = ref(true);
|
||||
//表单配置
|
||||
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
|
||||
labelWidth: 150,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}}
|
||||
});
|
||||
//表单赋值
|
||||
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
|
||||
//重置表单
|
||||
await resetFields();
|
||||
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!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>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number){
|
||||
width: 100%
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker){
|
||||
width: 100%
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<div>
|
||||
<#assign query_field_no=0>
|
||||
<#assign need_category = false>
|
||||
<#assign need_pca = false>
|
||||
<#assign need_search = false>
|
||||
<#assign need_dept_user = false>
|
||||
<#assign need_switch = false>
|
||||
<#assign need_dept = false>
|
||||
<#assign need_multi = false>
|
||||
<#assign need_popup = false>
|
||||
<#assign need_select_tag = false>
|
||||
<#assign need_select_tree = false>
|
||||
<#assign need_time = false>
|
||||
<#assign bpm_flag=false>
|
||||
<#assign need_markdown = false>
|
||||
<#assign need_upload = false>
|
||||
<#assign need_image_upload = false>
|
||||
<#assign need_editor = false>
|
||||
<#assign need_checkbox = false>
|
||||
<#assign query_flag = false>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<#-- 开始循环 -->
|
||||
<#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 need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_search'>
|
||||
<#assign need_search = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_user'>
|
||||
<#assign need_dept_user = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_depart'>
|
||||
<#assign need_dept = true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign need_switch = true>
|
||||
</#if>
|
||||
<#if po.classType=='list_multi'>
|
||||
<#assign need_multi = true>
|
||||
</#if>
|
||||
<#if po.classType=='popup'>
|
||||
<#assign need_popup = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_tree'>
|
||||
<#assign need_select_tree = true>
|
||||
</#if>
|
||||
<#if po.classType=='time'>
|
||||
<#assign need_time = true>
|
||||
</#if>
|
||||
<#include "/common/form/native/vue3NativeSearch.ftl">
|
||||
</#list>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
|
||||
</a>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<#-- 结束循环 -->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<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="selectedRowKeys.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 #pcaSlot="{text}">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</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 ref="registerModal" @success="handleSuccess"></${entityName}Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './${entityName}.data';
|
||||
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './${entityName}.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue'
|
||||
<#include "/common/form/native/vue3NativeImport.ftl">
|
||||
<#if need_category>
|
||||
import { loadCategoryData } from '/@/api/common/api';
|
||||
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
||||
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
|
||||
</#if>
|
||||
<#if need_pca>
|
||||
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
|
||||
</#if>
|
||||
|
||||
const queryParam = ref<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam.value);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "${tableVo.ftlDescription}",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const labelCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 },
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
function handleEdit(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
function handleDetail(record: Recordable) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && 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),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
queryParam.value = {};
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
<#if need_popup>
|
||||
/**
|
||||
* popup组件值改变事件
|
||||
*/
|
||||
function setFieldsValue(map) {
|
||||
Object.keys(map).map((key) => {
|
||||
queryParam.value[key] = map[key];
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_pca>
|
||||
/**
|
||||
* 省市区点击事件
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleAreaChange(key, value) {
|
||||
queryParam.value[key] = value.join(',');
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_category>
|
||||
/**
|
||||
* form点击事件
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
queryParam.value[key] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化字典配置
|
||||
*/
|
||||
function initDictConfig() {
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && 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 lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
width: calc(50% - 15px);
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,72 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
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 });
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const deleteOne = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||
}
|
||||
@ -0,0 +1,366 @@
|
||||
<#include "/common/utils.ftl">
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
{
|
||||
title: '${po.filedComment}',
|
||||
align: "center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:({text}) =>{
|
||||
return !text?"":(text.length>10?text.substr(0,10):text);
|
||||
},
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'htmlSlot' },
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'pcaSlot' },
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'fileSlot' },
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: render.renderImage,
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
customRender:({text}) => {
|
||||
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}]);
|
||||
},
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictText?default("")?trim?length == 0>
|
||||
customRender:({text}) => {
|
||||
return render.renderCategoryTree(text,'${po.dictField?default("")}');
|
||||
},
|
||||
<#else>
|
||||
customRender: ({text, record}) => (text ? record['${po.dictText}'] : '');
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
];
|
||||
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#if po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict: "${po.dictTable},${po.dictText},${po.dictField}"
|
||||
},
|
||||
<#elseif po.classType=='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
<#elseif po.classType=='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options: "${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType=='list_multi'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps: {
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictTable},${po.dictText},${po.dictField}"
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode: "${po.dictField?default("")}",//back和事件未添加,暂时有问题
|
||||
},
|
||||
<#elseif po.classType=='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'HH:mm:ss',
|
||||
},
|
||||
<#elseif po.classType=='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType=='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictTable},${po.dictText},${po.dictField}"
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
<#else>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='date'>
|
||||
component: 'RangePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
},
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'JRangeNumber',
|
||||
<#else>
|
||||
component: 'Input', //TODO 范围查询
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
];
|
||||
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign id_exists = false>
|
||||
<#list columns as po><#rt/>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.fieldDbName == 'id'>
|
||||
<#assign id_exists = true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
{
|
||||
label: '${po.filedComment}',
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#if po.classType =='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType =='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'HH:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType =='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options: ${po.dictField}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType =='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType =='markdown'>
|
||||
component: 'JMarkdownEditor',//注意string转换问题
|
||||
<#elseif po.classType =='password'>
|
||||
component: 'InputPassword',
|
||||
<#elseif po.classType =='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
componentProps:{
|
||||
labelKey: 'realname',
|
||||
},
|
||||
<#elseif po.classType =='textarea'>
|
||||
component: 'InputTextArea',
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
dictCode: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
dictCode: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode: "${po.dictField?default("")}", //TODO back和事件未添加,暂时有问题
|
||||
},
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'InputNumber',
|
||||
<#elseif po.classType=='file'>
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
maxCount: ${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='image'>
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
fileMax: ${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='umeditor'>
|
||||
component: 'JEditor',
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps:{
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict: "${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField: "${po.dictText?split(',')[1]}",
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField: "${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue: "${po.dictField}",
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
dynamicRules: ({model,schema}) => {
|
||||
<#if po.fieldName != 'id'>
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
return [
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'},
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'},
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
|
||||
<#-- 6到18位字符串 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern: /^.{6,18}$/, message: '请输入6到18位任意字符!'},
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!'},
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
];
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
<#if po.readonly=='Y'>
|
||||
dynamicDisabled: true
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
<#if id_exists == false>
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
</#if>
|
||||
];
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,186 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<#assign need_category = false>
|
||||
<#assign bpm_flag=false>
|
||||
<#assign need_pca = false>
|
||||
<#assign need_search = false>
|
||||
<#assign need_dept_user = false>
|
||||
<#assign need_switch = false>
|
||||
<#assign need_dept = false>
|
||||
<#assign need_multi = false>
|
||||
<#assign need_popup = false>
|
||||
<#assign need_select_tag = false>
|
||||
<#assign need_select_tree = false>
|
||||
<#assign need_time = false>
|
||||
<#assign need_markdown = false>
|
||||
<#assign need_upload = false>
|
||||
<#assign need_image_upload = false>
|
||||
<#assign need_editor = false>
|
||||
<#assign need_checkbox = false>
|
||||
<#assign hasOnlyValidate = false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
|
||||
<#assign hasOnlyValidate = true>
|
||||
</#if>
|
||||
<#include "/common/form/native/vue3NativeForm.ftl">
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import moment from 'moment';
|
||||
<#include "/common/form/native/vue3NativeImport.ftl">
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../${entityName}.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
<#if hasOnlyValidate == true>
|
||||
import { duplicateValidate } from '/@/utils/helper/validator'
|
||||
</#if>
|
||||
|
||||
const props = defineProps({
|
||||
disabled: { type: Boolean, default: false },
|
||||
});
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const formData = reactive<Record<string, any>>({
|
||||
<#list columns as po>
|
||||
id: '',
|
||||
<#if po.isShow == 'Y'>
|
||||
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
${po.fieldName}: undefined,
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
${po.fieldName}String: '',
|
||||
<#else>
|
||||
${po.fieldName}: '',
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(() => {
|
||||
resetFields();
|
||||
//赋值
|
||||
Object.assign(formData, record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
let model = formData;
|
||||
if (model.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in model) {
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (model[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
model[data] = model[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdate(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
createMessage.success(res.message);
|
||||
emit('ok');
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
<#if need_popup>
|
||||
/**
|
||||
* popup组件值改变事件
|
||||
*/
|
||||
function setFieldsValue(map) {
|
||||
Object.keys(map).map((key) => {
|
||||
formData[key] = map[key];
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_category || need_select_tree>
|
||||
/**
|
||||
* 值改变事件触发
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
formData[key] = value;
|
||||
}
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
|
||||
async function ${po.fieldName}Duplicatevalidate(_r, value) {
|
||||
return duplicateValidate('${tableName}', '${po.fieldDbName}', value, formData.id || '')
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
height: 500px !important;
|
||||
overflow-y: auto;
|
||||
padding: 24px 24px 24px 24px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<${entityName}Form ref="registerForm" @ok="submitCallback" :disabled="disableSubmit"></${entityName}Form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import ${entityName}Form from './${entityName}Form.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,278 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.vo.${entityName}Page;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
|
||||
</#list>
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller {
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
<#list subTables as sub>
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}Page
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
${entityName} ${entityName?uncap_first}Entity = ${entityName?uncap_first}Service.getById(${entityName?uncap_first}.getId());
|
||||
if(${entityName?uncap_first}Entity==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
${entityName?uncap_first}Service.updateMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
|
||||
}
|
||||
|
||||
<#list subTables as sub>
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${sub.ftlDescription}通过主表ID查询")
|
||||
@ApiOperation(value="${sub.ftlDescription}主表ID查询", notes="${sub.ftlDescription}-通主表ID查询")
|
||||
@GetMapping(value = "/query${sub.entityName}ByMainId")
|
||||
public Result<List<${sub.entityName}>> query${sub.entityName}ListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(id);
|
||||
return Result.OK(${sub.entityName?uncap_first}List);
|
||||
}
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//配置选中数据查询条件
|
||||
String selections = request.getParameter("selections");
|
||||
if(oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
queryWrapper.in("id",selectionList);
|
||||
}
|
||||
//Step.2 获取导出数据
|
||||
List<${entityName}> ${entityName?uncap_first}List = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<${entityName}Page> pageList = new ArrayList<${entityName}Page>();
|
||||
for (${entityName} main : ${entityName?uncap_first}List) {
|
||||
${entityName}Page vo = new ${entityName}Page();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
<#list subTables as sub>
|
||||
List<${sub.entityName}> ${sub.entityName?uncap_first}List = ${sub.entityName?uncap_first}Service.selectByMainId(main.getId());
|
||||
vo.set${sub.entityName}List(${sub.entityName?uncap_first}List);
|
||||
</#list>
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ${entityName}Page.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}数据", "导出人:"+sysUser.getRealname(), "${tableVo.ftlDescription}"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<${entityName}Page> list = ExcelImportUtil.importExcel(file.getInputStream(), ${entityName}Page.class, params);
|
||||
for (${entityName}Page page : list) {
|
||||
${entityName} po = new ${entityName}();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
${entityName?uncap_first}Service.saveMain(po, <#list subTables as sub>page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
<#include "/common/utils.ftl">
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "${camelToDashed(po.extendParams.text?default(\"realname\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"username\")?trim)}"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}.java
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@ApiModel(value="${subTab.tableName}对象", description="${subTab.ftlDescription}")
|
||||
@Data
|
||||
@TableName("${subTab.tableName}")
|
||||
public class ${subTab.entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list subTab.originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "${camelToDashed(po.extendParams.text?default(\"realname\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"username\")?trim)}"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,17 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}Mapper.java
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> {
|
||||
|
||||
/**
|
||||
* 通过主表id删除子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId);
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<${subTab.entityName}>
|
||||
*/
|
||||
public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId);
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,26 @@
|
||||
<#list subTables as subTab>
|
||||
<#assign originalForeignKeys = subTab.originalForeignKeys>
|
||||
#segment#${subTab.entityName}Mapper.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
|
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
SELECT *
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
</select>
|
||||
</mapper>
|
||||
</#list>
|
||||
@ -0,0 +1,54 @@
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
<#list subTables as sub>
|
||||
* @param ${sub.entityName?uncap_first}List
|
||||
</#list>
|
||||
*/
|
||||
public void saveMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
<#list subTables as sub>
|
||||
* @param ${sub.entityName?uncap_first}List
|
||||
</#list>
|
||||
*/
|
||||
public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#I${subTab.entityName}Service.java
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> {
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<${subTab.entityName}>
|
||||
*/
|
||||
public List<${subTab.entityName}> selectByMainId(String mainId);
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,105 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${sub.entityName}Mapper;
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
@Autowired
|
||||
private ${entityName}Mapper ${entityName?uncap_first}Mapper;
|
||||
<#list subTables as sub>
|
||||
@Autowired
|
||||
private ${sub.entityName}Mapper ${sub.entityName?uncap_first}Mapper;
|
||||
</#list>
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(${entityName} ${entityName?uncap_first}, <#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) {
|
||||
${entityName?uncap_first}Mapper.insert(${entityName?uncap_first});
|
||||
<#list subTables as sub>
|
||||
if(${sub.entityName?uncap_first}List!=null && ${sub.entityName?uncap_first}List.size()>0) {
|
||||
for(${sub.entityName} entity:${sub.entityName?uncap_first}List) {
|
||||
<#list sub.foreignKeys as key>
|
||||
//外键设置
|
||||
<#if key?lower_case?index_of("${primaryKeyField}")!=-1>
|
||||
entity.set${key?cap_first}(${entityName?uncap_first}.get${primaryKeyField?cap_first}());
|
||||
<#else>
|
||||
entity.set${key?cap_first}(${entityName?uncap_first}.get${key}());
|
||||
</#if>
|
||||
</#list>
|
||||
${sub.entityName?uncap_first}Mapper.insert(entity);
|
||||
}
|
||||
}
|
||||
</#list>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(${entityName} ${entityName?uncap_first},<#list subTables as sub>List<${sub.entityName}> ${sub.entityName?uncap_first}List<#if sub_has_next>,</#if></#list>) {
|
||||
${entityName?uncap_first}Mapper.updateById(${entityName?uncap_first});
|
||||
|
||||
//1.先删除子表数据
|
||||
<#list subTables as sub>
|
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(${entityName?uncap_first}.getId());
|
||||
</#list>
|
||||
|
||||
//2.子表数据重新插入
|
||||
<#list subTables as sub>
|
||||
if(${sub.entityName?uncap_first}List!=null && ${sub.entityName?uncap_first}List.size()>0) {
|
||||
for(${sub.entityName} entity:${sub.entityName?uncap_first}List) {
|
||||
<#list sub.foreignKeys as key>
|
||||
//外键设置
|
||||
<#if key?lower_case?index_of("${primaryKeyField}")!=-1>
|
||||
entity.set${key?cap_first}(${entityName?uncap_first}.get${primaryKeyField?cap_first}());
|
||||
<#else>
|
||||
entity.set${key?cap_first}(${entityName?uncap_first}.get${key}());
|
||||
</#if>
|
||||
</#list>
|
||||
${sub.entityName?uncap_first}Mapper.insert(entity);
|
||||
}
|
||||
}
|
||||
</#list>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
<#list subTables as sub>
|
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id);
|
||||
</#list>
|
||||
${entityName?uncap_first}Mapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
<#list subTables as sub>
|
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id.toString());
|
||||
</#list>
|
||||
${entityName?uncap_first}Mapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}ServiceImpl.java
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${subTab.entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${subTab.entityName}ServiceImpl extends ServiceImpl<${subTab.entityName}Mapper, ${subTab.entityName}> implements I${subTab.entityName}Service {
|
||||
|
||||
@Autowired
|
||||
private ${subTab.entityName}Mapper ${subTab.entityName?uncap_first}Mapper;
|
||||
|
||||
@Override
|
||||
public List<${subTab.entityName}> selectByMainId(String mainId) {
|
||||
return ${subTab.entityName?uncap_first}Mapper.selectByMainId(mainId);
|
||||
}
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,84 @@
|
||||
package ${bussiPackage}.${entityPackage}.vo;
|
||||
|
||||
import java.util.List;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="${tableName}Page对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName}Page {
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private java.lang.String ${po.fieldName}String;
|
||||
<#else>
|
||||
private ${po.fieldType} ${po.fieldName};
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
<#list subTables as sub>
|
||||
@ExcelCollection(name="${sub.ftlDescription}")
|
||||
@ApiModelProperty(value = "${sub.ftlDescription}")
|
||||
private List<${sub.entityName}> ${sub.entityName?uncap_first}List;
|
||||
</#list>
|
||||
|
||||
}
|
||||
@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#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.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=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>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField != 'is_open'>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/list",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/act/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
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.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,562 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<!-- 主表单区域 -->
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}" >
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}" <#if po.dictField != 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model="model.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model="model.${po.fieldName}"
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}"
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField="${po.dictText?split(',')[1]}"
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField="${po.dictText?split(',')[3]}"
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue="${po.dictField}"
|
||||
<#if po.readonly=='Y'>disabled</#if>>
|
||||
</j-tree-select>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</j-form-container>
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model="activeKey" @change="handleChangeTabs">
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<${Format.humpToShortbar(sub.entityName)}-form ref="${sub.entityName?uncap_first}Form" @validateError="validateError" :disabled="formDisabled"></${Format.humpToShortbar(sub.entityName)}-form>
|
||||
</a-tab-pane>
|
||||
|
||||
<#else>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<j-editable-table
|
||||
:ref="refKeys[${sub_index}]"
|
||||
:loading="${sub.entityName?uncap_first}Table.loading"
|
||||
:columns="${sub.entityName?uncap_first}Table.columns"
|
||||
:dataSource="${sub.entityName?uncap_first}Table.dataSource"
|
||||
:maxHeight="300"
|
||||
:disabled="formDisabled"
|
||||
:rowNumber="true"
|
||||
:rowSelection="true"
|
||||
:actionButton="true"/>
|
||||
</a-tab-pane>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-tabs>
|
||||
<#if bpm_flag>
|
||||
<a-row v-if="showFlowSubmitButton" style="text-align: center;width: 100%;margin-top: 16px;"><a-button icon="check" style="width: 126px" type="primary" @click="handleOk">提 交</a-button></a-row>
|
||||
</#if>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { getAction } from '@/api/manage'
|
||||
import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
|
||||
import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
import ${sub.entityName}Form from './${sub.entityName}Form.vue'
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
export default {
|
||||
name: '${entityName}Form',
|
||||
mixins: [JEditableTableModelMixin],
|
||||
components: {
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
${sub.entityName}Form,
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
model:{
|
||||
<#include "/common/init/initValue.ftl">
|
||||
},
|
||||
// 新增时子表默认添加几行空数据
|
||||
addDefaultRowNum: 1,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
refKeys: [<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>],
|
||||
<#assign hasOne2Many = false>
|
||||
tableKeys:[<#list subTables as sub><#if sub.foreignRelationType =='0'>'${sub.entityName?uncap_first}', <#assign hasOne2Many = true></#if></#list>],
|
||||
activeKey: '${subTables[0].entityName?uncap_first}',
|
||||
<#list subTables as sub><#rt/>
|
||||
// ${sub.ftlDescription}
|
||||
${sub.entityName?uncap_first}Table: {
|
||||
loading: false,
|
||||
dataSource: [],
|
||||
columns: [
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
<#assign popupBackFields = "">
|
||||
|
||||
<#-- 循环子表的列 开始 -->
|
||||
<#list sub.colums as col><#rt/>
|
||||
<#if col.isShow =='Y'>
|
||||
<#if col.filedComment !='外键' >
|
||||
{
|
||||
title: '${col.filedComment}',
|
||||
key: '${autoStringSuffixForModel(col)}',
|
||||
<#if col.classType =='date'>
|
||||
type: FormTypes.date,
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='datetime'>
|
||||
type: FormTypes.datetime,
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif "int,decimal,double,"?contains(col.classType)>
|
||||
type: FormTypes.inputNumber,
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='list' || col.classType =='radio'>
|
||||
type: FormTypes.select,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
type: FormTypes.list_multi,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='switch'>
|
||||
type: FormTypes.checkbox,
|
||||
<#if col.dictField == 'is_open'>
|
||||
customValue: ['Y', 'N'],
|
||||
<#else>
|
||||
customValue: ${col.dictField},
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='sel_search'>
|
||||
type: FormTypes.sel_search,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='sel_depart'>
|
||||
type: FormTypes.sel_depart,
|
||||
<#if col.extendParams.multiSelect?default(true) == false>
|
||||
multi: false,
|
||||
</#if>
|
||||
<#if col.extendParams.store?default("")?trim?length gt 1>
|
||||
store: "${col.extendParams.store}",
|
||||
</#if>
|
||||
<#if col.extendParams.text?default("")?trim?length gt 1>
|
||||
text: "${col.extendParams.text}",
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.classType =='sel_user'>
|
||||
type: FormTypes.sel_user,
|
||||
<#if col.extendParams.multiSelect?default(true) == false>
|
||||
multi: false,
|
||||
</#if>
|
||||
<#if col.extendParams.store?default("")?trim?length gt 1>
|
||||
store: "${col.extendParams.store}",
|
||||
</#if>
|
||||
<#if col.extendParams.text?default("")?trim?length gt 1>
|
||||
text: "${col.extendParams.text}",
|
||||
</#if>
|
||||
<#if col.readonly=='Y'>
|
||||
disabled: true,
|
||||
</#if>
|
||||
<#elseif col.classType =='image'>
|
||||
type: FormTypes.image,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#if col.uploadnum??>
|
||||
number: ${col.uploadnum},
|
||||
</#if>
|
||||
<#elseif col.classType =='file'>
|
||||
type: FormTypes.file,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#if col.uploadnum??>
|
||||
number: ${col.uploadnum},
|
||||
</#if>
|
||||
<#elseif col.classType =='popup'>
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">
|
||||
<#else>
|
||||
<#assign popupBackFields = "${col.dictText}">
|
||||
</#if>
|
||||
type: FormTypes.popup,
|
||||
popupCode:"${col.dictTable}",
|
||||
destFields:"${Format.underlineToHump(col.dictText)}",
|
||||
orgFields:"${col.dictField}",
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
|
||||
type: FormTypes.inputNumber,
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
<#else>
|
||||
type: FormTypes.input,
|
||||
<#if col.readonly=='Y'>
|
||||
disabled:true,
|
||||
</#if>
|
||||
</#if>
|
||||
<#if col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
width:"250px",
|
||||
<#else>
|
||||
width:"200px",
|
||||
</#if>
|
||||
<#if col.classType =='file'>
|
||||
placeholder: '请选择文件',
|
||||
<#else>
|
||||
placeholder: '请输入${'$'}{title}',
|
||||
</#if>
|
||||
<#if col.defaultVal??>
|
||||
<#if col.fieldDbType=="BigDecimal" || col.fieldDbType=="double" || col.fieldDbType=="int">
|
||||
defaultValue:${col.defaultVal},
|
||||
<#else>
|
||||
defaultValue:"${col.defaultVal}",
|
||||
</#if>
|
||||
<#else>
|
||||
defaultValue:'',
|
||||
</#if>
|
||||
<#-- 子表的校验 -->
|
||||
<#assign subFieldValidType = col.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if col.nullable == 'N' || subFieldValidType == '*'>
|
||||
validateRules: [{ required: true, message: '${'$'}{title}不能为空' }],
|
||||
<#-- 其他情况下,只要有值就被认为是正则校验 -->
|
||||
<#elseif subFieldValidType?length gt 0>
|
||||
<#assign subMessage = '格式不正确'>
|
||||
<#if subFieldValidType == 'only' >
|
||||
<#assign subMessage = '不能重复'>
|
||||
</#if>
|
||||
validateRules: [{ pattern: "${subFieldValidType}", message: "${'$'}{title}${subMessage}" }],
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 循环子表的列 结束 -->
|
||||
|
||||
<#-- 处理popup的隐藏列 -->
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#list popupBackFields?split(",") as item>
|
||||
<#if item?length gt 0>
|
||||
<#assign tempItemFlag = true>
|
||||
|
||||
<#list sub.colums as col>
|
||||
<#if col.isShow =='Y' && col.fieldName == item>
|
||||
<#assign tempItemFlag = false>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if tempItemFlag>
|
||||
{
|
||||
title: '${item}',
|
||||
key: '${item}',
|
||||
type:"hidden"
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</#if>
|
||||
]
|
||||
},
|
||||
</#list>
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
|
||||
<#list subTables as sub><#rt/>
|
||||
${sub.entityName?uncap_first}: {
|
||||
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
|
||||
},
|
||||
</#list>
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
<#if bpm_flag>
|
||||
//流程表单data
|
||||
formData: {
|
||||
type: Object,
|
||||
default: ()=>{},
|
||||
required: false
|
||||
},
|
||||
//表单模式:false流程表单 true普通表单
|
||||
formBpm: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
},
|
||||
</#if>
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
<#if bpm_flag>
|
||||
if(this.formBpm===true){
|
||||
if(this.formData.disabled===false){
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
</#if>
|
||||
return this.disabled
|
||||
},
|
||||
<#if bpm_flag>
|
||||
showFlowSubmitButton(){
|
||||
if(this.formBpm===true){
|
||||
if(this.formData.disabled===false){
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
</#if>
|
||||
},
|
||||
created () {
|
||||
<#if bpm_flag>
|
||||
//如果是流程中表单,则需要加载流程表单data
|
||||
this.showFlowData();
|
||||
</#if>
|
||||
},
|
||||
methods: {
|
||||
addBefore(){
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
this.$refs.${sub.entityName?uncap_first}Form.clearFormData()
|
||||
<#else>
|
||||
this.${sub.entityName?uncap_first}Table.dataSource=[]
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
getAllTable() {
|
||||
<#if hasOne2Many==true>
|
||||
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
||||
return Promise.all(values)
|
||||
<#else>
|
||||
return new Promise(resolve => {
|
||||
resolve([]);
|
||||
})
|
||||
</#if>
|
||||
},
|
||||
/** 调用完edit()方法之后会自动调用此方法 */
|
||||
editAfter() {
|
||||
this.$nextTick(() => {
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
this.$refs.${sub.entityName?uncap_first}Form.initFormData(this.url.${sub.entityName?uncap_first}.list,this.model.id)
|
||||
</#if>
|
||||
</#list>
|
||||
})
|
||||
// 加载子表数据
|
||||
if (this.model.id) {
|
||||
let params = { id: this.model.id }
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
this.requestSubTableData(this.url.${sub.entityName?uncap_first}.list, params, this.${sub.entityName?uncap_first}Table)
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
//校验所有一对一子表表单
|
||||
validateSubForm(allValues){
|
||||
return new Promise((resolve,reject)=>{
|
||||
Promise.all([
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
this.$refs.${sub.entityName?uncap_first}Form.validate(${sub_index}),
|
||||
</#if>
|
||||
</#list>
|
||||
]).then(() => {
|
||||
resolve(allValues)
|
||||
}).catch(e => {
|
||||
if (e.error === VALIDATE_NO_PASSED) {
|
||||
// 如果有未通过表单验证的子表,就自动跳转到它所在的tab
|
||||
this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 整理成formData */
|
||||
classifyIntoFormData(allValues) {
|
||||
let main = Object.assign(this.model, allValues.formValue)
|
||||
return {
|
||||
...main, // 展开
|
||||
<#assign subManyIndex = 0>
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
${sub.entityName?uncap_first}List: allValues.tablesValue[${subManyIndex}].values,
|
||||
<#assign subManyIndex = subManyIndex+1>
|
||||
<#else>
|
||||
${sub.entityName?uncap_first}List: this.$refs.${sub.entityName?uncap_first}Form.getFormData(),
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//渲染流程表单数据
|
||||
showFlowData(){
|
||||
if(this.formBpm === true){
|
||||
let params = {id:this.formData.dataId};
|
||||
getAction(this.url.queryById,params).then((res)=>{
|
||||
if(res.success){
|
||||
this.edit (res.result);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
</#if>
|
||||
validateError(msg){
|
||||
this.$message.error(msg)
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(this.model, backObj);
|
||||
}
|
||||
</#if>
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@ -0,0 +1,65 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="1200"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||
@cancel="handleCancel">
|
||||
<${Format.humpToShortbar(entityName)}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
|
||||
export default {
|
||||
name: '${entityName}Modal',
|
||||
components: {
|
||||
${entityName}Form
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title:'',
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.handleOk();
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@ -0,0 +1,197 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType=='1'>
|
||||
#segment#${sub.entityName}Form.vue
|
||||
<template>
|
||||
<j-form-container :disabled="disabled">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum == 2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list sub.colums as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple v-model="model.${po.fieldName}"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model="model.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</j-form-container>
|
||||
</template>
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
import { VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
|
||||
export default {
|
||||
name: '${sub.entityName}Form',
|
||||
components: {
|
||||
},
|
||||
props:{
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
model:{
|
||||
<#include "/common/init/initValueSub.ftl">
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
<#include "/common/validatorRulesTemplate/sub.ftl">
|
||||
confirmLoading: false,
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods:{
|
||||
initFormData(url,id){
|
||||
this.clearFormData()
|
||||
if(!id){
|
||||
this.edit(this.modelDefault)
|
||||
}else{
|
||||
getAction(url,{id:id}).then(res=>{
|
||||
if(res.success){
|
||||
let records = res.result
|
||||
if(records && records.length>0){
|
||||
this.edit(records[0])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
edit(record){
|
||||
this.model = Object.assign({}, record)
|
||||
console.log("${sub.entityName}Form-edit",this.model);
|
||||
},
|
||||
getFormData(){
|
||||
let formdata_arr = []
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
let isNullObj = true
|
||||
Object.keys(this.model).forEach(key=>{
|
||||
if(this.model[key]){
|
||||
isNullObj = false
|
||||
}
|
||||
})
|
||||
if(!isNullObj){
|
||||
formdata_arr.push(this.model)
|
||||
}
|
||||
}else{
|
||||
this.$emit("validateError","${sub.ftlDescription}表单校验未通过");
|
||||
}
|
||||
})
|
||||
return formdata_arr;
|
||||
},
|
||||
validate(index){
|
||||
return new Promise((resolve, reject) => {
|
||||
// 验证主表表单
|
||||
this.$refs.form.validate(valid => {
|
||||
!valid ? reject({ error: VALIDATE_NO_PASSED ,index}) : resolve()
|
||||
})
|
||||
}).then(values => {
|
||||
return Promise.resolve()
|
||||
}).catch(error => {
|
||||
return Promise.reject(error)
|
||||
})
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
clearFormData(){
|
||||
this.$refs.form.clearValidate()
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(backObj,this.model);
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</#if>
|
||||
</#list>
|
||||
@ -0,0 +1,297 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
<#assign pidFieldName = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service>{
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/rootList")
|
||||
public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
String hasQuery = req.getParameter("hasQuery");
|
||||
if(hasQuery != null && "true".equals(hasQuery)){
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.queryTreeListNoPage(queryWrapper);
|
||||
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}else{
|
||||
String parentId = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
|
||||
if (oConvertUtils.isEmpty(parentId)) {
|
||||
parentId = "0";
|
||||
}
|
||||
${entityName?uncap_first}.set${pidFieldName?cap_first}(null);
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
// 使用 eq 防止模糊查询
|
||||
queryWrapper.eq("${Format.humpToUnderline(pidFieldName)}", parentId);
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载节点的子数据
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeChildren", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeChildren(@RequestParam(name = "pid") String pid) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = ${entityName?uncap_first}Service.queryListByPid(pid);
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】加载一级节点/如果是同步 则所有数据
|
||||
*
|
||||
* @param async
|
||||
* @param pcode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadTreeRoot", method = RequestMethod.GET)
|
||||
public Result<List<SelectTreeModel>> loadTreeRoot(@RequestParam(name = "async") Boolean async, @RequestParam(name = "pcode") String pcode) {
|
||||
Result<List<SelectTreeModel>> result = new Result<>();
|
||||
try {
|
||||
List<SelectTreeModel> ls = ${entityName?uncap_first}Service.queryListByCode(pcode);
|
||||
if (!async) {
|
||||
loadAllChildren(ls);
|
||||
}
|
||||
result.setResult(ls);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.setMessage(e.getMessage());
|
||||
result.setSuccess(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 【vue3专用】递归求子节点 同步加载用到
|
||||
*
|
||||
* @param ls
|
||||
*/
|
||||
private void loadAllChildren(List<SelectTreeModel> ls) {
|
||||
for (SelectTreeModel tsm : ls) {
|
||||
List<SelectTreeModel> temp = ${entityName?uncap_first}Service.queryListByPid(tsm.getKey());
|
||||
if (temp != null && temp.size() > 0) {
|
||||
tsm.setChildren(temp);
|
||||
loadAllChildren(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子数据
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-获取子数据")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-获取子数据", notes="${tableVo.ftlDescription}-获取子数据")
|
||||
@GetMapping(value = "/childList")
|
||||
public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询子节点
|
||||
* @param parentIds 父ID(多个采用半角逗号分割)
|
||||
* @return 返回 IPage
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-批量获取子数据")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量获取子数据", notes="${tableVo.ftlDescription}-批量获取子数据")
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<${entityName}> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("${Format.humpToUnderline(pidFieldName)}", parentIdList);
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.add${entityName}(${entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.update${entityName}(${entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.delete${entityName}(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-通过id查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id查询", notes="${tableVo.ftlDescription}-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<${entityName}> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName} ${entityName?uncap_first} = ${entityName?uncap_first}Service.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
<#include "/common/utils.ftl">
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "${camelToDashed(po.extendParams.text?default(\"realname\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"username\")?trim)}"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- <#if po.classType!='popup'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
@Dict(dicCode="${po.dictField}")
|
||||
</#if>
|
||||
</#if>-->
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||
|
||||
/**
|
||||
* 编辑节点状态
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级ID查询树节点数据
|
||||
*
|
||||
* @param pid
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(@Param("pid") String pid, @Param("query") Map<String, String> query);
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
<#assign hasChildrenField = "">
|
||||
<#assign pidFieldName = "">
|
||||
<#assign textFieldName = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
<#-- begin 【vue3专用】 -->
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.textField>
|
||||
<#assign textFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#-- end 【vue3专用】 -->
|
||||
</#list>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
|
||||
<update id="updateTreeNodeStatus" parameterType="java.lang.String">
|
||||
update ${tableName} set ${Format.humpToUnderline(hasChildrenField)} = ${r'#'}{status} where id = ${r'#'}{id}
|
||||
</update>
|
||||
|
||||
<!-- 【vue3专用】 -->
|
||||
<select id="queryListByPid" parameterType="java.lang.Object" resultType="org.jeecg.common.system.vo.SelectTreeModel">
|
||||
select
|
||||
id as "key",
|
||||
${textFieldName} as "title",
|
||||
(case when ${Format.humpToUnderline(hasChildrenField)} = '1' then 0 else 1 end) as isLeaf,
|
||||
${pidFieldName} as parentId
|
||||
from ${tableName}
|
||||
where ${pidFieldName} = ${r'#'}{pid}
|
||||
<if test="query != null">
|
||||
<foreach collection="query.entrySet()" item="value" index="key">
|
||||
and ${r'$'}{key} = ${r'#'}{value}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,74 @@
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
|
||||
/**根节点父ID的值*/
|
||||
public static final String ROOT_PID_VALUE = "0";
|
||||
|
||||
/**树节点有子节点状态值*/
|
||||
public static final String HASCHILD = "1";
|
||||
|
||||
/**树节点无子节点状态值*/
|
||||
public static final String NOCHILD = "0";
|
||||
|
||||
/**
|
||||
* 新增节点
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
*/
|
||||
void add${entityName}(${entityName} ${entityName?uncap_first});
|
||||
|
||||
/**
|
||||
* 修改节点
|
||||
*
|
||||
* @param ${entityName?uncap_first}
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void update${entityName}(${entityName} ${entityName?uncap_first}) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param id
|
||||
* @throws JeecgBootException
|
||||
*/
|
||||
void delete${entityName}(String id) throws JeecgBootException;
|
||||
|
||||
/**
|
||||
* 查询所有数据,无分页
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @return List<${entityName}>
|
||||
*/
|
||||
List<${entityName}> queryTreeListNoPage(QueryWrapper<${entityName}> queryWrapper);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据父级编码加载分类字典的数据
|
||||
*
|
||||
* @param parentCode
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByCode(String parentCode);
|
||||
|
||||
/**
|
||||
* 【vue3专用】根据pid查询子节点集合
|
||||
*
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<SelectTreeModel> queryListByPid(String pid);
|
||||
|
||||
}
|
||||
@ -0,0 +1,229 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasChildrenField = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
@Override
|
||||
public void add${entityName}(${entityName} ${entityName?uncap_first}) {
|
||||
//新增时设置hasChild为0
|
||||
${entityName?uncap_first}.set${hasChildrenField?cap_first}(I${entityName}Service.NOCHILD);
|
||||
if(oConvertUtils.isEmpty(${entityName?uncap_first}.get${pidFieldName?cap_first}())){
|
||||
${entityName?uncap_first}.set${pidFieldName?cap_first}(I${entityName}Service.ROOT_PID_VALUE);
|
||||
}else{
|
||||
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
|
||||
${entityName} parent = baseMapper.selectById(${entityName?uncap_first}.get${pidFieldName?cap_first}());
|
||||
if(parent!=null && !"1".equals(parent.get${hasChildrenField?cap_first}())){
|
||||
parent.set${hasChildrenField?cap_first}("1");
|
||||
baseMapper.updateById(parent);
|
||||
}
|
||||
}
|
||||
baseMapper.insert(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update${entityName}(${entityName} ${entityName?uncap_first}) {
|
||||
${entityName} entity = this.getById(${entityName?uncap_first}.getId());
|
||||
if(entity==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
String old_pid = entity.get${pidFieldName?cap_first}();
|
||||
String new_pid = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
|
||||
if(!old_pid.equals(new_pid)) {
|
||||
updateOldParentNode(old_pid);
|
||||
if(oConvertUtils.isEmpty(new_pid)){
|
||||
${entityName?uncap_first}.set${pidFieldName?cap_first}(I${entityName}Service.ROOT_PID_VALUE);
|
||||
}
|
||||
if(!I${entityName}Service.ROOT_PID_VALUE.equals(${entityName?uncap_first}.get${pidFieldName?cap_first}())) {
|
||||
baseMapper.updateTreeNodeStatus(${entityName?uncap_first}.get${pidFieldName?cap_first}(), I${entityName}Service.HASCHILD);
|
||||
}
|
||||
}
|
||||
baseMapper.updateById(${entityName?uncap_first});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete${entityName}(String id) throws JeecgBootException {
|
||||
//查询选中节点下所有子节点一并删除
|
||||
id = this.queryTreeChildIds(id);
|
||||
if(id.indexOf(",")>0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String[] idArr = id.split(",");
|
||||
for (String idVal : idArr) {
|
||||
if(idVal != null){
|
||||
${entityName} ${entityName?uncap_first} = this.getById(idVal);
|
||||
String pidVal = ${entityName?uncap_first}.get${pidFieldName?cap_first}();
|
||||
//查询此节点上一级是否还有其他子节点
|
||||
List<${entityName}> dataList = baseMapper.selectList(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pidVal).notIn("id",Arrays.asList(idArr)));
|
||||
boolean flag = (dataList == null || dataList.size() == 0) && !Arrays.asList(idArr).contains(pidVal) && !sb.toString().contains(pidVal);
|
||||
if(flag){
|
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(pidVal).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
//批量删除节点
|
||||
baseMapper.deleteBatchIds(Arrays.asList(idArr));
|
||||
//修改已无子节点的标识
|
||||
String[] pidArr = sb.toString().split(",");
|
||||
for(String pid : pidArr){
|
||||
this.updateOldParentNode(pid);
|
||||
}
|
||||
}else{
|
||||
${entityName} ${entityName?uncap_first} = this.getById(id);
|
||||
if(${entityName?uncap_first}==null) {
|
||||
throw new JeecgBootException("未找到对应实体");
|
||||
}
|
||||
updateOldParentNode(${entityName?uncap_first}.get${pidFieldName?cap_first}());
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${entityName}> queryTreeListNoPage(QueryWrapper<${entityName}> queryWrapper) {
|
||||
List<${entityName}> dataList = baseMapper.selectList(queryWrapper);
|
||||
List<${entityName}> mapList = new ArrayList<>();
|
||||
for(${entityName} data : dataList){
|
||||
String pidVal = data.get${pidFieldName?cap_first}();
|
||||
//递归查询子节点的根节点
|
||||
if(pidVal != null && !I${entityName}Service.NOCHILD.equals(pidVal)){
|
||||
${entityName} rootVal = this.getTreeRoot(pidVal);
|
||||
if(rootVal != null && !mapList.contains(rootVal)){
|
||||
mapList.add(rootVal);
|
||||
}
|
||||
}else{
|
||||
if(!mapList.contains(data)){
|
||||
mapList.add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByCode(String parentCode) {
|
||||
String pid = ROOT_PID_VALUE;
|
||||
if (oConvertUtils.isNotEmpty(parentCode)) {
|
||||
LambdaQueryWrapper<${entityName}> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(${entityName}::get${pidFieldName?cap_first}, parentCode);
|
||||
List<${entityName}> list = baseMapper.selectList(queryWrapper);
|
||||
if (list == null || list.size() == 0) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】不存在,请核实!");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
throw new JeecgBootException("该编码【" + parentCode + "】存在多个,请核实!");
|
||||
}
|
||||
pid = list.get(0).getId();
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectTreeModel> queryListByPid(String pid) {
|
||||
if (oConvertUtils.isEmpty(pid)) {
|
||||
pid = ROOT_PID_VALUE;
|
||||
}
|
||||
return baseMapper.queryListByPid(pid, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值
|
||||
* @param pid
|
||||
*/
|
||||
private void updateOldParentNode(String pid) {
|
||||
if(!I${entityName}Service.ROOT_PID_VALUE.equals(pid)) {
|
||||
Long count = baseMapper.selectCount(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pid));
|
||||
if(count==null || count<=1) {
|
||||
baseMapper.updateTreeNodeStatus(pid, I${entityName}Service.NOCHILD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询节点的根节点
|
||||
* @param pidVal
|
||||
* @return
|
||||
*/
|
||||
private ${entityName} getTreeRoot(String pidVal){
|
||||
${entityName} data = baseMapper.selectById(pidVal);
|
||||
if(data != null && !I${entityName}Service.ROOT_PID_VALUE.equals(data.get${pidFieldName?cap_first}())){
|
||||
return this.getTreeRoot(data.get${pidFieldName?cap_first}());
|
||||
}else{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询所有子节点id
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private String queryTreeChildIds(String ids) {
|
||||
//获取id数组
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String pidVal : idArr) {
|
||||
if(pidVal != null){
|
||||
if(!sb.toString().contains(pidVal)){
|
||||
if(sb.toString().length() > 0){
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(pidVal);
|
||||
this.getTreeChildIds(pidVal,sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有子节点
|
||||
* @param pidVal
|
||||
* @param sb
|
||||
* @return
|
||||
*/
|
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){
|
||||
List<${entityName}> dataList = baseMapper.selectList(new QueryWrapper<${entityName}>().eq("${tableVo.extendParams.pidField}", pidVal));
|
||||
if(dataList != null && dataList.size()>0){
|
||||
for(${entityName} tree : dataList) {
|
||||
if(!sb.toString().contains(tree.getId())){
|
||||
sb.append(",").append(tree.getId());
|
||||
}
|
||||
this.getTreeChildIds(tree.getId(),sb);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,523 @@
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasChildrenField = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#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.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=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>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:expandedRowKeys="expandedRowKeys"
|
||||
@change="handleTableChange"
|
||||
@expand="handleExpand"
|
||||
v-bind="tableProps">
|
||||
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleAddChild(record)">添加下级</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteNode(record.id)" placement="topLeft">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { getAction, deleteAction } from '@/api/manage'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
import { filterObj } from '@/utils/util';
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: {
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName==tableVo.extendParams.textField>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"left",
|
||||
dataIndex: '${po.fieldName}'
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#if po.fieldDbName!=tableVo.extendParams.textField && po.fieldName!=pidFieldName>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"left",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField != 'is_open'>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text, record) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/rootList",
|
||||
childList: "/${entityPackage}/${entityName?uncap_first}/childList",
|
||||
getChildListBatch: "/${entityPackage}/${entityName?uncap_first}/getChildListBatch",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
},
|
||||
expandedRowKeys:[],
|
||||
hasChildrenField:"${hasChildrenField}",
|
||||
pidField:"${pidFieldName}",
|
||||
dictOptions: {},
|
||||
loadParent: false,
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
},
|
||||
tableProps() {
|
||||
let _this = this
|
||||
return {
|
||||
// 列表项是否可选择
|
||||
rowSelection: {
|
||||
selectedRowKeys: _this.selectedRowKeys,
|
||||
onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData(arg){
|
||||
if(arg==1){
|
||||
this.ipagination.current=1
|
||||
}
|
||||
this.loading = true
|
||||
let params = this.getQueryParams()
|
||||
params.hasQuery = 'true'
|
||||
getAction(this.url.list,params).then(res=>{
|
||||
if(res.success){
|
||||
let result = res.result
|
||||
if(Number(result.total)>0){
|
||||
this.ipagination.total = Number(result.total)
|
||||
this.dataSource = this.getDataByResult(res.result.records)
|
||||
return this.loadDataByExpandedRows(this.dataSource)
|
||||
}else{
|
||||
this.ipagination.total=0
|
||||
this.dataSource=[]
|
||||
}
|
||||
}else{
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(()=>{
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
|
||||
loadDataByExpandedRows(dataList) {
|
||||
if (this.expandedRowKeys.length > 0) {
|
||||
return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{
|
||||
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[this.pidField];
|
||||
if (this.expandedRowKeys.join(',').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 (this.expandedRowKeys.includes(data.id)) {
|
||||
data.children = this.getDataByResult(childrenMap.get(data.id))
|
||||
fn(data.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
fn(dataList)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
},
|
||||
getQueryParams(arg) {
|
||||
//获取查询条件
|
||||
let sqp = {}
|
||||
let param = {}
|
||||
if(this.superQueryParams){
|
||||
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
||||
sqp['superQueryMatchType'] = this.superQueryMatchType
|
||||
}
|
||||
if(arg){
|
||||
param = Object.assign(sqp, this.isorter ,this.filters);
|
||||
}else{
|
||||
param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
|
||||
}
|
||||
if(JSON.stringify(this.queryParam) === "{}" || arg){
|
||||
param.hasQuery = 'false'
|
||||
}else{
|
||||
param.hasQuery = 'true'
|
||||
}
|
||||
param.field = this.getQueryField();
|
||||
param.pageNo = this.ipagination.current;
|
||||
param.pageSize = this.ipagination.pageSize;
|
||||
return filterObj(param);
|
||||
},
|
||||
searchReset() {
|
||||
//重置
|
||||
this.expandedRowKeys = []
|
||||
this.queryParam = {}
|
||||
this.loadData(1);
|
||||
},
|
||||
getDataByResult(result){
|
||||
if(result){
|
||||
return result.map(item=>{
|
||||
//判断是否标记了带有子节点
|
||||
if(item[this.hasChildrenField]=='1'){
|
||||
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
|
||||
item.children = [loadChild]
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
},
|
||||
handleExpand(expanded, record){
|
||||
// 判断是否是展开状态
|
||||
if (expanded) {
|
||||
this.expandedRowKeys.push(record.id)
|
||||
if (record.children.length>0 && record.children[0].isLoading === true) {
|
||||
let params = this.getQueryParams(1);//查询条件
|
||||
params[this.pidField] = record.id
|
||||
params.hasQuery = 'false'
|
||||
params.superQueryParams=""
|
||||
getAction(this.url.childList,params).then((res)=>{
|
||||
if(res.success){
|
||||
if(res.result.records){
|
||||
record.children = this.getDataByResult(res.result.records)
|
||||
this.dataSource = [...this.dataSource]
|
||||
}else{
|
||||
record.children=''
|
||||
record.hasChildrenField='0'
|
||||
}
|
||||
}else{
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
}else{
|
||||
let keyIndex = this.expandedRowKeys.indexOf(record.id)
|
||||
if(keyIndex>=0){
|
||||
this.expandedRowKeys.splice(keyIndex, 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
handleAddChild(record){
|
||||
this.loadParent = true
|
||||
let obj = {}
|
||||
obj[this.pidField] = record['id']
|
||||
this.$refs.modalForm.add(obj);
|
||||
},
|
||||
handleDeleteNode(id) {
|
||||
if(!this.url.delete){
|
||||
this.$message.error("请设置url.delete属性!")
|
||||
return
|
||||
}
|
||||
var that = this;
|
||||
deleteAction(that.url.delete, {id: id}).then((res) => {
|
||||
if (res.success) {
|
||||
that.loadData(1)
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
batchDel(){
|
||||
if(this.selectedRowKeys.length<=0){
|
||||
this.$message.warning('请选择一条记录!');
|
||||
return false;
|
||||
}else{
|
||||
let ids = "";
|
||||
let that = this;
|
||||
that.selectedRowKeys.forEach(function(val) {
|
||||
ids+=val+",";
|
||||
});
|
||||
that.$confirm({
|
||||
title:"确认删除",
|
||||
content:"是否删除选中数据?",
|
||||
onOk: function(){
|
||||
that.handleDeleteNode(ids)
|
||||
that.onClearSelected();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getSuperFieldList(){
|
||||
<#include "/common/utils.ftl">
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,246 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||
<#assign pidFieldName = "">
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model="model.${po.fieldName}"
|
||||
dict="${tableVo.tableName},${tableVo.extendParams.textField},id"
|
||||
pidField="${tableVo.extendParams.pidField}"
|
||||
pidValue="0"
|
||||
hasChildField="${tableVo.extendParams.hasChildren}"
|
||||
<#if po.readonly=='Y'>disabled</#if>>
|
||||
</j-tree-select>
|
||||
<#elseif po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}" <#if po.dictField != 'is_open'>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model="model.${po.fieldName}"
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}"
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField="${po.dictText?split(',')[1]}"
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField="${po.dictText?split(',')[3]}"
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue="${po.dictField}"
|
||||
<#if po.readonly=='Y'>disabled</#if>>
|
||||
</j-tree-select>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
export default {
|
||||
name: "${entityName}Modal",
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:800,
|
||||
visible: false,
|
||||
model:{
|
||||
<#include "/common/init/initValue.ftl">
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
},
|
||||
expandedRowKeys:[],
|
||||
pidField:"${pidFieldName}"
|
||||
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods: {
|
||||
add (obj) {
|
||||
this.modelDefault.${pidFieldName}=''
|
||||
this.edit(Object.assign(this.modelDefault , obj));
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.$refs.form.clearValidate()
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
if(this.model.id && this.model.id === this.model[this.pidField]){
|
||||
that.$message.warning("父级节点不能选择自己");
|
||||
that.confirmLoading = false;
|
||||
return;
|
||||
}
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
this.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(this.model, backObj);
|
||||
},
|
||||
</#if>
|
||||
submitSuccess(formData,flag){
|
||||
if(!formData.id){
|
||||
let treeData = this.$refs.treeSelect.getCurrTreeData()
|
||||
this.expandedRowKeys=[]
|
||||
this.getExpandKeysByPid(formData[this.pidField],treeData,treeData)
|
||||
this.$emit('ok',formData,this.expandedRowKeys.reverse());
|
||||
}else{
|
||||
this.$emit('ok',formData,flag);
|
||||
}
|
||||
},
|
||||
getExpandKeysByPid(pid,arr,all){
|
||||
if(pid && arr && arr.length>0){
|
||||
for(let i=0;i<arr.length;i++){
|
||||
if(arr[i].key==pid){
|
||||
this.expandedRowKeys.push(arr[i].key)
|
||||
this.getExpandKeysByPid(arr[i]['parentId'],all,all)
|
||||
}else{
|
||||
this.getExpandKeysByPid(pid,arr[i].children,all)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,399 @@
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasChildrenField = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
<#assign list_need_pca=false>
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<template>
|
||||
<div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleCreate" 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="selectedRowKeys.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)" :dropDownActions="getDropDownAction(record)"/>
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{text}">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<!--省市区字段回显插槽-->
|
||||
<template #pcaSlot="{text}">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</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"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup>
|
||||
//ts语法
|
||||
import {ref, computed, unref, toRaw, nextTick} from 'vue';
|
||||
import {BasicTable, TableAction} from '/@/components/Table';
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage'
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue';
|
||||
import {columns,searchFormSchema} from './${entityName}.data';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import {list, delete${entityName}, batchDelete${entityName}, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './${entityName}.api';
|
||||
<#if list_need_pca>
|
||||
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
|
||||
</#if>
|
||||
<#if bpm_flag==true>
|
||||
import { startProcess } from '/@/api/common/api';
|
||||
</#if>
|
||||
const expandedRowKeys = ref([]);
|
||||
//字典model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
api: list,
|
||||
title: '${tableVo.ftlDescription}',
|
||||
columns,
|
||||
canResize:false,
|
||||
formConfig: {
|
||||
labelWidth: 120,
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter:true,
|
||||
showAdvancedButton:true,
|
||||
fieldMapToNumber: [
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#if po.queryMode!='single'>
|
||||
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end']],
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
],
|
||||
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>
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 240,
|
||||
fixed:'right'
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name:"${tableVo.ftlDescription}",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: importSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload, collapseAll, updateTableDataRecord, findTableDataRecord,getDataSource},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
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 = selectedRowKeys.value.filter(item => !item.includes('loading'))
|
||||
await batchDelete${entityName}({id: ids}, importSuccess);
|
||||
}
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
function importSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 添加下级
|
||||
*/
|
||||
function handleAddSub(record) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
async function handleSuccess({isUpdate, values, expandedArr, changeParent}) {
|
||||
if (isUpdate) {
|
||||
if (changeParent) {
|
||||
reload();
|
||||
} else {
|
||||
// 编辑回调
|
||||
updateTableDataRecord(values.id, values);
|
||||
}
|
||||
} else {
|
||||
if(!values['id'] || !values['${pidFieldName}']){
|
||||
//新增根节点
|
||||
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['${pidFieldName}'];
|
||||
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({${pidFieldName}: 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({${pidFieldName}: 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: '添加下级',
|
||||
onClick: handleAddSub.bind(null, {${pidFieldName}: record.id}),
|
||||
}
|
||||
]
|
||||
}
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
<#if bpm_flag==true>
|
||||
let dropDownAction = [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record)
|
||||
}
|
||||
}
|
||||
];
|
||||
if(record.bpmStatus == '1'){
|
||||
dropDownAction.push({
|
||||
label: '发起流程',
|
||||
popConfirm: {
|
||||
title: '确认提交流程吗?',
|
||||
confirm: handleProcess.bind(null, record),
|
||||
}
|
||||
})
|
||||
}
|
||||
return dropDownAction;
|
||||
<#else>
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
</#if>
|
||||
}
|
||||
|
||||
<#if bpm_flag==true>
|
||||
/**
|
||||
* 提交流程
|
||||
*/
|
||||
async function handleProcess(record) {
|
||||
let params = {
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
await startProcess(params);
|
||||
await reload();
|
||||
}
|
||||
</#if>
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,85 @@
|
||||
import {defHttp} from "/@/utils/http/axios";
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/${entityPackage}/${entityName?uncap_first}/rootList',
|
||||
save='/${entityPackage}/${entityName?uncap_first}/add',
|
||||
edit='/${entityPackage}/${entityName?uncap_first}/edit',
|
||||
delete${entityName} = '/${entityPackage}/${entityName?uncap_first}/delete',
|
||||
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) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.delete${entityName}, 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,405 @@
|
||||
<#include "/common/utils.ftl">
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
{
|
||||
title: '${po.filedComment}',
|
||||
<#if po.fieldDbName == tableVo.extendParams.textField>
|
||||
align: 'left',
|
||||
<#else>
|
||||
align: 'center',
|
||||
</#if>
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:({text}) =>{
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
},
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'htmlSlot' },
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'pcaSlot' },
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'fileSlot' },
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:render.renderImage,
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
customRender:({text}) => {
|
||||
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
},
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictText?default("")?trim?length == 0>
|
||||
customRender:({text}) => {
|
||||
return render.renderCategoryTree(text,'${po.dictField?default("")}')
|
||||
},
|
||||
<#else>
|
||||
customRender: ({text, record}) => (text ? record['${po.dictText}'] : '')
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
];
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict:"${po.dictTable},${po.dictText},${po.dictField}"
|
||||
},
|
||||
<#elseif po.classType=='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
<#elseif po.classType=='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options:"${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType=='list_multi'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictTable},${po.dictText},${po.dictField}",
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictField}",
|
||||
</#if>
|
||||
triggerChange: true
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode:"${po.dictField?default("")}",//back和事件未添加,暂时有问题
|
||||
},
|
||||
<#elseif po.classType=='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime:true
|
||||
},
|
||||
<#elseif po.classType=='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType=='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps:{
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[1]??>
|
||||
pidField:"${po.dictText?split(',')[1]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[3]??>
|
||||
hasChildField:"${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue:"${po.dictField}",
|
||||
},
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictTable},${po.dictText},${po.dictField}"
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode:"${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
<#else>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='date'>
|
||||
component: 'RangePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
showTime:true
|
||||
},
|
||||
<#elseif po.classType == 'time'>
|
||||
component: 'TimePicker',
|
||||
componentProps:{
|
||||
valueFormat: 'HH:mm:ss',
|
||||
},
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'JRangeNumber',
|
||||
<#else>
|
||||
component: 'Input', //TODO 范围查询
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
];
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign id_exists = false>
|
||||
<#list columns as po><#rt/>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.fieldDbName == 'id'>
|
||||
<#assign id_exists = true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
{
|
||||
label: '${po.filedComment}',
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#-- update-begin-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
|
||||
<#if po.defaultVal??>
|
||||
<#if po.fieldDbType=="BigDecimal" || po.fieldDbType=="double" || po.fieldDbType=="int">
|
||||
defaultValue: ${po.defaultVal},
|
||||
<#else>
|
||||
defaultValue: "${po.defaultVal}",
|
||||
</#if>
|
||||
</#if>
|
||||
<#-- update-end-author:taoyan date:2022-6-24 for: VUEN-1190【代码生成】默认值未生成 -->
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
component: 'JTreeSelect',
|
||||
componentProps: {
|
||||
dict: "${tableVo.tableName},${tableVo.extendParams.textField},id",
|
||||
pidField: "${tableVo.extendParams.pidField}",
|
||||
pidValue: "0",
|
||||
hasChildField: "${tableVo.extendParams.hasChildren}",
|
||||
},
|
||||
<#elseif po.classType =='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType =='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime:true,
|
||||
valueFormat: 'YYYY-MM-DD hh:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps:{
|
||||
valueFormat: 'HH:mm:ss',
|
||||
},
|
||||
<#elseif po.classType =='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType =='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options:${po.dictField}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType =='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType =='markdown'>
|
||||
component: 'JMarkdownEditor',//注意string转换问题
|
||||
<#elseif po.classType =='password'>
|
||||
component: 'InputPassword',
|
||||
<#elseif po.classType =='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
componentProps:{
|
||||
labelKey:'realname',
|
||||
},
|
||||
<#elseif po.classType =='textarea'>
|
||||
component: 'InputTextArea',
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
dictCode:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
dictCode:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict:"${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode:"${po.dictField?default("")}", //TODO back和事件未添加,暂时有问题
|
||||
},
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'InputNumber',
|
||||
<#elseif po.classType=='file'>
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
maxCount:${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='image'>
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
fileMax:${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='umeditor'>
|
||||
component: 'JEditor',
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps:{
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict:"${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[1]??>
|
||||
pidField:"${po.dictText?split(',')[1]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[3]??>
|
||||
hasChildField:"${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue:"${po.dictField}",
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
<#include "/common/utils.ftl">
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
dynamicRules: ({model,schema}) => {
|
||||
<#if po.fieldName != 'id'>
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
return [
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'},
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!'},
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!'},
|
||||
<#-- 6到18位字母 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern:/^[a-z|A-Z]{6,18}$/, message: '请输入6到18位字母!'},
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!'},
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!'},
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!'},
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!'},
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!'},
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!'},
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!'},
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
];
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
<#if po.readonly=='Y'>
|
||||
dynamicDisabled:true
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
<#if id_exists == false>
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false
|
||||
},
|
||||
</#if>
|
||||
];
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,118 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasChildrenField = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :width="${getModalWidth(tableVo.fieldRowNum?default(1))}" :title="getTitle" @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';
|
||||
import {formSchema} from '../${entityName}.data';
|
||||
import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api';
|
||||
// 获取emit
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const expandedRowKeys = ref([]);
|
||||
const treeData = ref([]);
|
||||
// 当前编辑的数据
|
||||
let model:Nullable<Recordable> = null;
|
||||
//表单配置
|
||||
const [registerForm, {setProps,resetFields, setFieldsValue, validate, updateSchema}] = useForm({
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: {span: ${getFormSpan(tableVo.fieldRowNum?default(1))}},
|
||||
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 ,showOkBtn: !!!data?.hideFooter});
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
if (data?.record) {
|
||||
model = data.record;
|
||||
//表单赋值
|
||||
await setFieldsValue({
|
||||
...data.record,
|
||||
});
|
||||
} else {
|
||||
model = null;
|
||||
}
|
||||
//父级节点树信息
|
||||
treeData.value = await loadTreeData({'async': false,'pcode':''});
|
||||
// 隐藏底部时禁用整个表单
|
||||
setProps({ disabled: !!data?.hideFooter })
|
||||
});
|
||||
//设置标题
|
||||
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['${pidFieldName}'],unref(treeData))
|
||||
//刷新列表(isUpdate:是否编辑;values:表单信息;expandedArr:展开的节点信息)
|
||||
emit('success', {
|
||||
isUpdate: unref(isUpdate),
|
||||
values: {...values},
|
||||
expandedArr: unref(expandedRowKeys).reverse(),
|
||||
// 是否更改了父级节点
|
||||
changeParent: model != null && (model['${pidFieldName}'] != values['${pidFieldName}']),
|
||||
});
|
||||
} finally {
|
||||
setModalProps({confirmLoading: false});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/** 时间和数字输入框样式 */
|
||||
:deep(.ant-input-number){
|
||||
width: 100%
|
||||
}
|
||||
|
||||
:deep(.ant-calendar-picker){
|
||||
width: 100%
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,497 @@
|
||||
<template>
|
||||
<div>
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasChildrenField = "">
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.hasChildren>
|
||||
<#assign hasChildrenField = po.fieldName>
|
||||
</#if>
|
||||
</#list>
|
||||
<#assign query_field_no=0>
|
||||
<#assign need_category = false>
|
||||
<#assign need_pca = false>
|
||||
<#assign need_search = false>
|
||||
<#assign need_dept_user = false>
|
||||
<#assign need_switch = false>
|
||||
<#assign need_dept = false>
|
||||
<#assign need_multi = false>
|
||||
<#assign need_popup = false>
|
||||
<#assign need_select_tag = false>
|
||||
<#assign need_select_tree = false>
|
||||
<#assign need_time = false>
|
||||
<#assign bpm_flag=false>
|
||||
<#assign need_markdown = false>
|
||||
<#assign need_upload = false>
|
||||
<#assign need_image_upload = false>
|
||||
<#assign need_editor = false>
|
||||
<#assign need_checkbox = false>
|
||||
<#assign query_flag = false>
|
||||
<!--查询区域-->
|
||||
<div class="jeecg-basic-table-form-container">
|
||||
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-row :gutter="24">
|
||||
<#-- 开始循环 -->
|
||||
<#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 need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_search'>
|
||||
<#assign need_search = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_user'>
|
||||
<#assign need_dept_user = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_depart'>
|
||||
<#assign need_dept = true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign need_switch = true>
|
||||
</#if>
|
||||
<#if po.classType=='list_multi'>
|
||||
<#assign need_multi = true>
|
||||
</#if>
|
||||
<#if po.classType=='popup'>
|
||||
<#assign need_popup = true>
|
||||
</#if>
|
||||
<#if po.classType=='sel_tree'>
|
||||
<#assign need_select_tree = true>
|
||||
</#if>
|
||||
<#if po.classType=='time'>
|
||||
<#assign need_time = true>
|
||||
</#if>
|
||||
<#include "/common/form/native/vue3NativeSearch.ftl">
|
||||
</#list>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||
<a-col :lg="6">
|
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
|
||||
</a>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<#-- 结束循环 -->
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expandedRowKeys="expandedRowKeys" @expand="handleExpand" @fetch-success="onFetchSuccess">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-dropdown v-if="selectedRowKeys.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)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
<!--字段回显插槽-->
|
||||
<template #htmlSlot="{ text }">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<!--省市区字段回显插槽-->
|
||||
<template #pcaSlot="{ text }">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</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 ref="registerModal" @success="handleSuccess"></${entityName}Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup>
|
||||
import { ref, reactive, unref } from 'vue';
|
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { columns } from './${entityName}.data';
|
||||
import {list, delete${entityName}, batchDelete${entityName}, getExportUrl,getImportUrl, getChildList,getChildListBatch} from './${entityName}.api';
|
||||
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue'
|
||||
<#include "/common/form/native/vue3NativeImport.ftl">
|
||||
<#if need_category>
|
||||
import { loadCategoryData } from '/@/api/common/api';
|
||||
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
||||
import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum';
|
||||
</#if>
|
||||
<#if need_pca>
|
||||
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
|
||||
</#if>
|
||||
|
||||
const expandedRowKeys = ref([]);
|
||||
const queryParam = ref<any>({});
|
||||
const toggleSearchStatus = ref<boolean>(false);
|
||||
const registerModal = ref();
|
||||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam.value);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: "${tableVo.ftlDescription}",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: success
|
||||
},
|
||||
});
|
||||
const [registerTable, {reload, collapseAll, updateTableDataRecord, findTableDataRecord,getDataSource},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
const labelCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 },
|
||||
});
|
||||
const wrapperCol = reactive({
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑事件
|
||||
*/
|
||||
async function handleEdit(record) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
async function handleDetail(record) {
|
||||
registerModal.value.disableSubmit = true;
|
||||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除事件
|
||||
*/
|
||||
async function handleDelete(record) {
|
||||
await delete${entityName}({ id: record.id }, success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
const ids = selectedRowKeys.value.filter((item) => !item.includes('loading'));
|
||||
await batchDelete${entityName}({ id: ids }, success);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调刷新页面
|
||||
*/
|
||||
function success() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加下级
|
||||
*/
|
||||
function handleAddSub(record) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
async function handleSuccess({ isUpdate, values, expandedArr, changeParent }) {
|
||||
if (isUpdate) {
|
||||
if (changeParent) {
|
||||
reload();
|
||||
} else {
|
||||
// 编辑回调
|
||||
updateTableDataRecord(values.id, values);
|
||||
}
|
||||
} else {
|
||||
if (!values['id'] || !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['${pidFieldName}'];
|
||||
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({ ${pidFieldName}: 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({ ${pidFieldName}: 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),
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '添加下级',
|
||||
onClick: handleAddSub.bind(null, { pid: record.id }),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '确定删除吗?',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
function searchQuery() {
|
||||
reload();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function searchReset() {
|
||||
queryParam.value = {};
|
||||
selectedRowKeys.value = [];
|
||||
//刷新数据
|
||||
reload();
|
||||
}
|
||||
|
||||
<#if need_popup>
|
||||
/**
|
||||
* popup组件值改变事件
|
||||
*/
|
||||
function setFieldsValue(map) {
|
||||
Object.keys(map).map((key) => {
|
||||
queryParam.value[key] = map[key];
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_pca>
|
||||
/**
|
||||
* 省市区点击事件
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleAreaChange(key, value) {
|
||||
queryParam.value[key] = value.join(',');
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_category>
|
||||
/**
|
||||
* form点击事件
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
queryParam.value[key] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化字典配置
|
||||
*/
|
||||
function initDictConfig() {
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType=='cat_tree' && 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 lang="less" scoped>
|
||||
.jeecg-basic-table-form-container {
|
||||
.table-page-search-submitButtons {
|
||||
display: block;
|
||||
margin-bottom: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.query-group-cust{
|
||||
width: calc(50% - 15px);
|
||||
min-width: 100px !important;
|
||||
}
|
||||
.query-group-split-cust{
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
text-align: center
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,93 @@
|
||||
import { defHttp } from "/@/utils/http/axios";
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/${entityPackage}/${entityName?uncap_first}/rootList',
|
||||
save='/${entityPackage}/${entityName?uncap_first}/add',
|
||||
edit='/${entityPackage}/${entityName?uncap_first}/edit',
|
||||
delete${entityName} = '/${entityPackage}/${entityName?uncap_first}/delete',
|
||||
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 });
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const delete${entityName} = (params,handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.delete${entityName}, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
* @param handleSuccess
|
||||
*/
|
||||
export const batchDelete${entityName} = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.delete${entityName}, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
* @param isUpdate
|
||||
*/
|
||||
export const saveOrUpdateDict = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url: url, params },{ isTransformResponse:false });
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部树形节点数据
|
||||
* @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,399 @@
|
||||
<#include "/common/utils.ftl">
|
||||
import {BasicColumn} from '/@/components/Table';
|
||||
import {FormSchema} from '/@/components/Table';
|
||||
import { rules} from '/@/utils/helper/validator';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y' && po.fieldName !='id'>
|
||||
{
|
||||
title: '${po.filedComment}',
|
||||
<#if po.fieldDbName == tableVo.extendParams.textField>
|
||||
align: 'left',
|
||||
<#else>
|
||||
align: 'center',
|
||||
</#if>
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:({text}) =>{
|
||||
return !text?"":(text.length>10?text.substr(0,10):text);
|
||||
},
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'htmlSlot' },
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'pcaSlot' },
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
slots: { customRender: 'fileSlot' },
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: render.renderImage,
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
<#if po.dictField?default("")?contains("[")>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
customRender:({text}) => {
|
||||
return render.renderSwitch(text, [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}]);
|
||||
},
|
||||
<#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictText?default("")?trim?length == 0>
|
||||
customRender:({text}) => {
|
||||
return render.renderCategoryTree(text,'${po.dictField?default("")}');
|
||||
},
|
||||
<#else>
|
||||
customRender: ({text, record}) => (text ? record['${po.dictText}'] : '');
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
];
|
||||
|
||||
//查询数据
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps: {
|
||||
dict:"${po.dictTable},${po.dictText},${po.dictField}"
|
||||
},
|
||||
<#elseif po.classType=='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
<#elseif po.classType=='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps: {
|
||||
<#if po.dictField != 'is_open'>
|
||||
options: '${po.dictField}',
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType=='list_multi'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps: {
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
options: "${po.dictField}",
|
||||
dictCode: "${po.dictTable},${po.dictText},${po.dictField}",
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictField}",
|
||||
</#if>
|
||||
triggerChange: true
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode:"${po.dictField?default("")}",//back和事件未添加,暂时有问题
|
||||
},
|
||||
<#elseif po.classType=='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true
|
||||
},
|
||||
<#elseif po.classType=='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType=='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps: {
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict: "${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[1]??>
|
||||
pidField: "${po.dictText?split(',')[1]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[3]??>
|
||||
hasChildField: "${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue: "${po.dictField}",
|
||||
},
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictTable},${po.dictText},${po.dictField}"
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
dictCode: "${po.dictField}"
|
||||
</#if>
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
<#else>
|
||||
{
|
||||
label: "${po.filedComment}",
|
||||
field: "${po.fieldName}",
|
||||
<#if po.classType=='date'>
|
||||
component: 'RangePicker',
|
||||
<#elseif po.classType=='datetime'>
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
showTime: true
|
||||
},
|
||||
<#elseif po.classType == 'time'>
|
||||
component: 'TimePicker',
|
||||
componentProps:{
|
||||
valueFormat: 'HH:mm:ss',
|
||||
},
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'JRangeNumber',
|
||||
<#else>
|
||||
component: 'Input', //TODO 范围查询
|
||||
</#if>
|
||||
colProps: {span: 6},
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
];
|
||||
|
||||
//表单数据
|
||||
export const formSchema: FormSchema[] = [
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign bpm_flag=false>
|
||||
<#assign id_exists = false>
|
||||
<#list columns as po><#rt/>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.fieldDbName == 'id'>
|
||||
<#assign id_exists = true>
|
||||
</#if>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
{
|
||||
label: '${po.filedComment}',
|
||||
field: ${autoStringSuffix(po)},
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
component: 'JTreeSelect',
|
||||
componentProps: {
|
||||
dict: "${tableVo.tableName},${tableVo.extendParams.textField},id",
|
||||
pidField: "${tableVo.extendParams.pidField}",
|
||||
pidValue: "0",
|
||||
hasChildField: "${tableVo.extendParams.hasChildren}",
|
||||
},
|
||||
<#elseif po.classType =='date'>
|
||||
component: 'DatePicker',
|
||||
<#elseif po.classType =='datetime'>
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime:true,
|
||||
valueFormat: 'YYYY-MM-DD hh:mm:ss'
|
||||
},
|
||||
<#elseif po.classType =='time'>
|
||||
component: 'TimePicker',
|
||||
componentProps:{
|
||||
valueFormat: 'HH:mm:ss',
|
||||
},
|
||||
<#elseif po.classType =='popup'>
|
||||
<#include "/common/form/vue3popup.ftl">
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
component: 'JSelectDept',
|
||||
<#elseif po.classType =='switch'>
|
||||
component: 'JSwitch',
|
||||
componentProps:{
|
||||
<#if po.dictField != 'is_open'>
|
||||
options:${po.dictField}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType =='pca'>
|
||||
component: 'JAreaLinkage',
|
||||
<#elseif po.classType =='markdown'>
|
||||
component: 'JMarkdownEditor',//注意string转换问题
|
||||
<#elseif po.classType =='password'>
|
||||
component: 'InputPassword',
|
||||
<#elseif po.classType =='sel_user'>
|
||||
component: 'JSelectUserByDept',
|
||||
componentProps:{
|
||||
labelKey: 'realname',
|
||||
},
|
||||
<#elseif po.classType =='textarea'>
|
||||
component: 'InputTextArea',
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
component: 'JDictSelectTag',
|
||||
componentProps:{
|
||||
dictCode: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
component: 'JSelectMultiple',
|
||||
componentProps:{
|
||||
dictCode: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='sel_search'>
|
||||
component: 'JSearchSelect',
|
||||
componentProps:{
|
||||
dict: "${form_field_dictCode}"
|
||||
},
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
component: 'JCategorySelect',
|
||||
componentProps:{
|
||||
pcode: "${po.dictField?default("")}", //TODO back和事件未添加,暂时有问题
|
||||
},
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
component: 'InputNumber',
|
||||
<#elseif po.classType=='file'>
|
||||
component: 'JUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
maxCount: ${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='image'>
|
||||
component: 'JImageUpload',
|
||||
componentProps:{
|
||||
<#if po.uploadnum??>
|
||||
fileMax: ${po.uploadnum}
|
||||
</#if>
|
||||
},
|
||||
<#elseif po.classType=='umeditor'>
|
||||
component: 'JEditor',
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
component: 'JTreeSelect',
|
||||
componentProps:{
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict: "${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[1]??>
|
||||
pidField: "${po.dictText?split(',')[1]}",
|
||||
</#if>
|
||||
<#if po.dictText?split(',')[3]??>
|
||||
hasChildField: "${po.dictText?split(',')[3]}",
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue: "${po.dictField}",
|
||||
},
|
||||
<#else>
|
||||
component: 'Input',
|
||||
</#if>
|
||||
<#include "/common/utils.ftl">
|
||||
<#if po.isShow == 'Y' && poHasCheck(po)>
|
||||
dynamicRules: ({ model, schema }) => {
|
||||
<#if po.fieldName != 'id'>
|
||||
<#assign fieldValidType = po.fieldValidType!''>
|
||||
return [
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!' },
|
||||
<#elseif fieldValidType!=''>
|
||||
{ required: false },
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
{...rules.duplicateCheckRule(<#if sub?default("")?trim?length gt 1>'${sub.tableName}'<#else>'${tableName}'</#if>, '${po.fieldDbName}',model,schema)[0]},
|
||||
<#-- 6到16位数字 -->
|
||||
<#elseif fieldValidType == 'n6-16'>
|
||||
{ pattern: /^\d{6,16}$/, message: '请输入6到16位数字!' },
|
||||
<#-- 6到16位任意字符 -->
|
||||
<#elseif fieldValidType == '*6-16'>
|
||||
{ pattern: /^.{6,16}$/, message: '请输入6到16位任意字符!' },
|
||||
<#-- 6到18位字母 -->
|
||||
<#elseif fieldValidType == 's6-18'>
|
||||
{ pattern:/^[a-z|A-Z]{6,18}$/, message: '请输入6到18位字母!' },
|
||||
<#-- 网址 -->
|
||||
<#elseif fieldValidType == 'url'>
|
||||
{ pattern: /^((ht|f)tps?):\/\/[\w\-]+(\.[\w\-]+)+([\w\-.,@?^=%&:\/~+#]*[\w\-@?^=%&\/~+#])?$/, message: '请输入正确的网址!' },
|
||||
<#-- 电子邮件 -->
|
||||
<#elseif fieldValidType == 'e'>
|
||||
{ pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/, message: '请输入正确的电子邮件!' },
|
||||
<#-- 手机号码 -->
|
||||
<#elseif fieldValidType == 'm'>
|
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!' },
|
||||
<#-- 邮政编码 -->
|
||||
<#elseif fieldValidType == 'p'>
|
||||
{ pattern: /^[0-9]\d{5}$/, message: '请输入正确的邮政编码!' },
|
||||
<#-- 字母 -->
|
||||
<#elseif fieldValidType == 's'>
|
||||
{ pattern: /^[A-Z|a-z]+$/, message: '请输入字母!' },
|
||||
<#-- 数字 -->
|
||||
<#elseif fieldValidType == 'n'>
|
||||
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' },
|
||||
<#-- 整数 -->
|
||||
<#elseif fieldValidType == 'z'>
|
||||
{ pattern: /^-?\d+$/, message: '请输入整数!' },
|
||||
<#-- 金额 -->
|
||||
<#elseif fieldValidType == 'money'>
|
||||
{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },
|
||||
<#-- 正则校验 -->
|
||||
<#elseif fieldValidType != '' && fieldValidType != '*'>
|
||||
{ pattern: '${fieldValidType}', message: '不符合校验规则!' },
|
||||
<#-- 无校验 -->
|
||||
<#else>
|
||||
<#t>
|
||||
</#if>
|
||||
];
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
<#if po.readonly=='Y'>
|
||||
dynamicDisabled: true
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
<#if id_exists == false>
|
||||
// TODO 主键隐藏字段,目前写死为ID
|
||||
{
|
||||
label: '',
|
||||
field: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
</#if>
|
||||
];
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,237 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-row>
|
||||
<#assign need_category = false>
|
||||
<#assign bpm_flag=false>
|
||||
<#assign need_pca = false>
|
||||
<#assign need_search = false>
|
||||
<#assign need_dept_user = false>
|
||||
<#assign need_switch = false>
|
||||
<#assign need_dept = false>
|
||||
<#assign need_multi = false>
|
||||
<#assign need_popup = false>
|
||||
<#assign need_select_tag = false>
|
||||
<#assign need_select_tree = false>
|
||||
<#assign need_time = false>
|
||||
<#assign need_markdown = false>
|
||||
<#assign need_upload = false>
|
||||
<#assign need_image_upload = false>
|
||||
<#assign need_editor = false>
|
||||
<#assign need_checkbox = false>
|
||||
<#assign pidFieldName = "">
|
||||
<#assign hasOnlyValidate = false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
|
||||
<#assign hasOnlyValidate = true>
|
||||
</#if>
|
||||
<#if po.fieldDbName == tableVo.extendParams.pidField>
|
||||
<#assign pidFieldName = po.fieldName>
|
||||
<#assign need_select_tree = true>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="父级节点" v-bind="validateInfos.${autoStringSuffixForModel(po)}">
|
||||
<j-tree-select
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model:value="formData.${po.fieldName}"
|
||||
dict="${tableVo.tableName},${tableVo.extendParams.textField},id"
|
||||
pidField="${tableVo.extendParams.pidField}"
|
||||
pidValue="0"
|
||||
hasChildField="${tableVo.extendParams.hasChildren}"
|
||||
<#if po.readonly=='Y'>disabled<#else>:disabled="disabled"</#if>>
|
||||
</j-tree-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
<#include "/common/form/native/vue3NativeForm.ftl">
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, unref, defineProps, computed } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import moment from 'moment';
|
||||
<#include "/common/form/native/vue3NativeImport.ftl">
|
||||
import { getValueType } from '/@/utils';
|
||||
import {loadTreeData, saveOrUpdateDict} from '../${entityName}.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
<#if hasOnlyValidate == true>
|
||||
import { duplicateValidate } from '/@/utils/helper/validator'
|
||||
</#if>
|
||||
|
||||
const useForm = Form.useForm;
|
||||
const formRef = ref();
|
||||
const isUpdate = ref(true);
|
||||
const expandedRowKeys = ref([]);
|
||||
const treeData = ref([]);
|
||||
const pidField = ref<string>('pid');
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
let model: Nullable<Recordable> = null;
|
||||
const formData = reactive<Record<string, any>>({
|
||||
<#list columns as po>
|
||||
id: '',
|
||||
<#if po.isShow == 'Y'>
|
||||
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
${po.fieldName}: undefined,
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
${po.fieldName}String: '',
|
||||
<#else>
|
||||
${po.fieldName}: '',
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = {
|
||||
<#include "/common/validatorRulesTemplate/native/vue3MainNative.ftl">
|
||||
};
|
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
|
||||
const props = defineProps({
|
||||
disabled: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add(obj = {}) {
|
||||
edit(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
nextTick(async () => {
|
||||
resetFields();
|
||||
expandedRowKeys.value = [];
|
||||
treeData.value = await loadTreeData({ async: false, pcode: '' });
|
||||
//赋值
|
||||
Object.assign(formData, record);
|
||||
model = record
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据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 submitForm() {
|
||||
// 触发表单验证
|
||||
await validate();
|
||||
confirmLoading.value = true;
|
||||
const isUpdate = ref<boolean>(false);
|
||||
//时间格式化
|
||||
if (formData.id) {
|
||||
isUpdate.value = true;
|
||||
}
|
||||
//循环数据
|
||||
for (let data in formData) {
|
||||
//如果该数据是数组并且是字符串类型
|
||||
if (formData[data] instanceof Array) {
|
||||
let valueType = getValueType(formRef.value.getProps, data);
|
||||
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||
if (valueType === 'string') {
|
||||
formData[data] = formData[data].join(',');
|
||||
}
|
||||
}
|
||||
}
|
||||
await saveOrUpdateDict(formData, isUpdate.value)
|
||||
.then(async (res) => {
|
||||
if (res.success) {
|
||||
await getExpandKeysByPid(formData['${pidFieldName}'], unref(treeData));
|
||||
emit('ok', {
|
||||
isUpdate: unref(isUpdate),
|
||||
values: { ...formData },
|
||||
expandedArr: unref(expandedRowKeys).reverse(),
|
||||
// 是否更改了父级节点
|
||||
changeParent: model != null && model['${pidFieldName}'] != formData['${pidFieldName}'],
|
||||
});
|
||||
createMessage.success(res.message);
|
||||
} else {
|
||||
createMessage.warning(res.message);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
<#if need_popup>
|
||||
/**
|
||||
* popup组件值改变事件
|
||||
*/
|
||||
function setFieldsValue(map) {
|
||||
Object.keys(map).map((key) => {
|
||||
formData[key] = map[key];
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#if need_category || need_select_tree>
|
||||
/**
|
||||
* 值改变事件触发
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
formData[key] = value;
|
||||
}
|
||||
</#if>
|
||||
|
||||
<#list columns as po>
|
||||
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
|
||||
async function ${po.fieldName}Duplicatevalidate(_r, value) {
|
||||
return duplicateValidate('${tableName}', '${po.fieldDbName}', value, formData.id || '')
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.antd-modal-form {
|
||||
height: 500px !important;
|
||||
overflow-y: auto;
|
||||
padding: 24px 24px 24px 24px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<${entityName}Form ref="registerForm" @ok="submitCallback" :disabled="disableSubmit"></${entityName}Form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import ${entityName}Form from './${entityName}Form.vue'
|
||||
|
||||
const title = ref<string>('');
|
||||
const width = ref<number>(800);
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add(obj={}) {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add(obj);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback({ isUpdate, values, expandedArr, changeParent }) {
|
||||
handleCancel();
|
||||
emit('success', {
|
||||
isUpdate: isUpdate,
|
||||
values: values,
|
||||
expandedArr: expandedArr,
|
||||
// 是否更改了父级节点
|
||||
changeParent: changeParent,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,308 @@
|
||||
package ${bussiPackage}.${entityPackage}.controller;
|
||||
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import java.util.Arrays;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.service.I${sub.entityName}Service;
|
||||
</#list>
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="${tableVo.ftlDescription}")
|
||||
@RestController
|
||||
@RequestMapping("/${entityPackage}/${entityName?uncap_first}")
|
||||
@Slf4j
|
||||
public class ${entityName}Controller extends JeecgController<${entityName}, I${entityName}Service> {
|
||||
|
||||
@Autowired
|
||||
private I${entityName}Service ${entityName?uncap_first}Service;
|
||||
<#list subTables as sub>
|
||||
|
||||
@Autowired
|
||||
private I${sub.entityName}Service ${sub.entityName?uncap_first}Service;
|
||||
</#list>
|
||||
|
||||
|
||||
/*---------------------------------主表处理-begin-------------------------------------*/
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param ${entityName?uncap_first}
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${tableVo.ftlDescription}-分页列表查询")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-分页列表查询", notes="${tableVo.ftlDescription}-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<${entityName}>> queryPageList(${entityName} ${entityName?uncap_first},
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${entityName}> page = new Page<${entityName}>(pageNo, pageSize);
|
||||
IPage<${entityName}> pageList = ${entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-添加")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param ${entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-编辑", notes="${tableVo.ftlDescription}-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
${entityName?uncap_first}Service.updateById(${entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-通过id删除", notes="${tableVo.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
${entityName?uncap_first}Service.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量删除", notes="${tableVo.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${entityName?uncap_first}Service.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ${entityName} ${entityName?uncap_first}) {
|
||||
return super.exportXls(request, ${entityName?uncap_first}, ${entityName}.class, "${tableVo.ftlDescription}");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ${entityName}.class);
|
||||
}
|
||||
/*---------------------------------主表处理-end-------------------------------------*/
|
||||
|
||||
<#list subTables as sub>
|
||||
|
||||
/*--------------------------------子表处理-${sub.ftlDescription}-begin----------------------------------------------*/
|
||||
/**
|
||||
* 通过主表ID查询
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "${sub.ftlDescription}-通过主表ID查询")
|
||||
@ApiOperation(value="${sub.ftlDescription}-通过主表ID查询", notes="${sub.ftlDescription}-通过主表ID查询")
|
||||
@GetMapping(value = "/list${sub.entityName}ByMainId")
|
||||
public Result<IPage<${sub.entityName}>> list${sub.entityName}ByMainId(${sub.entityName} ${sub.entityName?uncap_first},
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, req.getParameterMap());
|
||||
Page<${sub.entityName}> page = new Page<${sub.entityName}>(pageNo, pageSize);
|
||||
IPage<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param ${sub.entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}-添加")
|
||||
@ApiOperation(value="${sub.ftlDescription}-添加", notes="${sub.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add${sub.entityName}")
|
||||
public Result<String> add${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
|
||||
${sub.entityName?uncap_first}Service.save(${sub.entityName?uncap_first});
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param ${sub.entityName?uncap_first}
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}-编辑")
|
||||
@ApiOperation(value="${sub.ftlDescription}-编辑", notes="${sub.ftlDescription}-编辑")
|
||||
@RequestMapping(value = "/edit${sub.entityName}", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit${sub.entityName}(@RequestBody ${sub.entityName} ${sub.entityName?uncap_first}) {
|
||||
${sub.entityName?uncap_first}Service.updateById(${sub.entityName?uncap_first});
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}-通过id删除")
|
||||
@ApiOperation(value="${sub.ftlDescription}-通过id删除", notes="${sub.ftlDescription}-通过id删除")
|
||||
@DeleteMapping(value = "/delete${sub.entityName}")
|
||||
public Result<String> delete${sub.entityName}(@RequestParam(name="id",required=true) String id) {
|
||||
${sub.entityName?uncap_first}Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${sub.ftlDescription}-批量删除")
|
||||
@ApiOperation(value="${sub.ftlDescription}-批量删除", notes="${sub.ftlDescription}-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch${sub.entityName}")
|
||||
public Result<String> deleteBatch${sub.entityName}(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.${sub.entityName?uncap_first}Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/export${sub.entityName}")
|
||||
public ModelAndView export${sub.entityName}(HttpServletRequest request, ${sub.entityName} ${sub.entityName?uncap_first}) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<${sub.entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${sub.entityName?uncap_first}, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
// Step.2 获取导出数据
|
||||
List<${sub.entityName}> pageList = ${sub.entityName?uncap_first}Service.list(queryWrapper);
|
||||
List<${sub.entityName}> exportList = null;
|
||||
|
||||
// 过滤选中数据
|
||||
String selections = request.getParameter("selections");
|
||||
if (oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
|
||||
} else {
|
||||
exportList = pageList;
|
||||
}
|
||||
|
||||
// Step.3 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
//此处设置的filename无效,前端会重更新设置一下
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "${sub.ftlDescription}");
|
||||
mv.addObject(NormalExcelConstants.CLASS, ${sub.entityName}.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${sub.ftlDescription}报表", "导出人:" + sysUser.getRealname(), "${sub.ftlDescription}"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/import${sub.entityName}/{mainId}")
|
||||
public Result<?> import${sub.entityName}(HttpServletRequest request, HttpServletResponse response, @PathVariable("mainId") String mainId) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<${sub.entityName}> list = ExcelImportUtil.importExcel(file.getInputStream(), ${sub.entityName}.class, params);
|
||||
for (${sub.entityName} temp : list) {
|
||||
<#list sub.foreignKeys as key>
|
||||
temp.set${key?cap_first}(mainId);
|
||||
</#list>
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
${sub.entityName?uncap_first}Service.saveBatch(list);
|
||||
log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
/*--------------------------------子表处理-${sub.ftlDescription}-end----------------------------------------------*/
|
||||
</#list>
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
<#include "/common/utils.ftl">
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
|
||||
public class ${entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "${camelToDashed(po.extendParams.text?default(\"realname\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"username\")?trim)}"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
<#elseif po.classType=='sel_tree'>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText?split(",")[2]}", dicCode = "${po.dictText?split(",")[0]}"'>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}.java
|
||||
package ${bussiPackage}.${entityPackage}.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("${subTab.tableName}")
|
||||
@ApiModel(value="${subTab.tableName}对象", description="${subTab.ftlDescription}")
|
||||
public class ${subTab.entityName} implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list subTab.originalColumns as po>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
<#else>
|
||||
<#if po.fieldDbType =='Date' || po.fieldDbType =='Datetime'>
|
||||
<#if po.classType=='date'>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
</#if>
|
||||
<#elseif !subTab.foreignKeys?seq_contains(po.fieldName?cap_first)>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15)
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
<#if po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
@Dict(dicCode = "${po.dictField}",dicText = "${po.dictText}",dictTable = "${po.dictTable}")
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
@Dict(dicCode = "${po.dictField}")
|
||||
</#if>
|
||||
</#if>
|
||||
<#if po.classType =='cat_tree'>
|
||||
@Dict(dicCode = "id",dicText = "name",dictTable = "sys_category")
|
||||
</#if>
|
||||
<#if po.classType =='sel_depart'>
|
||||
<#assign list_field_dictCode='dicCode = "${camelToDashed(po.extendParams.store?default(\"id\")?trim)}", dicText = "${camelToDashed(po.extendParams.text?default(\"depart_name\")?trim)}", dictTable = "sys_depart"'>
|
||||
@Dict(${list_field_dictCode})
|
||||
</#if>
|
||||
<#-- 大字段转换 -->
|
||||
<#include "/common/blob.ftl">
|
||||
</#list>
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,17 @@
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${entityName}Mapper extends BaseMapper<${entityName}> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}Mapper.java
|
||||
package ${bussiPackage}.${entityPackage}.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ${subTab.entityName}Mapper extends BaseMapper<${subTab.entityName}> {
|
||||
|
||||
/**
|
||||
* 通过主表id删除子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId);
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<${subTab.entityName}>
|
||||
*/
|
||||
public List<${subTab.entityName}> selectByMainId(@Param("mainId") String mainId);
|
||||
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,28 @@
|
||||
<#list subTables as subTab>
|
||||
<#assign originalForeignKeys = subTab.originalForeignKeys>
|
||||
#segment#${subTab.entityName}Mapper.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper">
|
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
|
||||
</delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="${bussiPackage}.${entityPackage}.entity.${subTab.entityName}">
|
||||
SELECT *
|
||||
FROM ${subTab.tableName}
|
||||
WHERE
|
||||
<#list originalForeignKeys as key>
|
||||
${key} = ${r'#'}{mainId} <#rt/>
|
||||
</#list>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
</#list>
|
||||
@ -0,0 +1,36 @@
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${entityName}Service extends IService<${entityName}> {
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#I${subTab.entityName}Service.java
|
||||
package ${bussiPackage}.${entityPackage}.service;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface I${subTab.entityName}Service extends IService<${subTab.entityName}> {
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId
|
||||
* @return List<${subTab.entityName}>
|
||||
*/
|
||||
public List<${subTab.entityName}> selectByMainId(String mainId);
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,56 @@
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${entityName};
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.entity.${sub.entityName};
|
||||
</#list>
|
||||
<#list subTables as sub>
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${sub.entityName}Mapper;
|
||||
</#list>
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, ${entityName}> implements I${entityName}Service {
|
||||
|
||||
@Autowired
|
||||
private ${entityName}Mapper ${entityName?uncap_first}Mapper;
|
||||
<#list subTables as sub>
|
||||
@Autowired
|
||||
private ${sub.entityName}Mapper ${sub.entityName?uncap_first}Mapper;
|
||||
</#list>
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
<#list subTables as sub>
|
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id);
|
||||
</#list>
|
||||
${entityName?uncap_first}Mapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for(Serializable id:idList) {
|
||||
<#list subTables as sub>
|
||||
${sub.entityName?uncap_first}Mapper.deleteByMainId(id.toString());
|
||||
</#list>
|
||||
${entityName?uncap_first}Mapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<#list subTables as subTab>
|
||||
#segment#${subTab.entityName}ServiceImpl.java
|
||||
package ${bussiPackage}.${entityPackage}.service.impl;
|
||||
|
||||
import ${bussiPackage}.${entityPackage}.entity.${subTab.entityName};
|
||||
import ${bussiPackage}.${entityPackage}.mapper.${subTab.entityName}Mapper;
|
||||
import ${bussiPackage}.${entityPackage}.service.I${subTab.entityName}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: ${subTab.ftlDescription}
|
||||
* @Author: jeecg-boot
|
||||
* @Date: ${.now?string["yyyy-MM-dd"]}
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ${subTab.entityName}ServiceImpl extends ServiceImpl<${subTab.entityName}Mapper, ${subTab.entityName}> implements I${subTab.entityName}Service {
|
||||
|
||||
@Autowired
|
||||
private ${subTab.entityName}Mapper ${subTab.entityName?uncap_first}Mapper;
|
||||
|
||||
@Override
|
||||
public List<${subTab.entityName}> selectByMainId(String mainId) {
|
||||
return ${subTab.entityName?uncap_first}Mapper.selectByMainId(mainId);
|
||||
}
|
||||
}
|
||||
</#list>
|
||||
@ -0,0 +1,457 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign subMainFieldMap={}>
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=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>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
|
||||
:customRow="clickThenSelect"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<a-tabs defaultActiveKey="1">
|
||||
<#assign sub_seq=1>
|
||||
<#list subTables as sub>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" key="${sub_seq}" <#if sub_seq gt 1>forceRender</#if>>
|
||||
<${sub.entityName}List :mainId="${sub.entityName?uncap_first}MainId" />
|
||||
</a-tab-pane>
|
||||
<#assign sub_seq=sub_seq+1>
|
||||
</#list>
|
||||
</a-tabs>
|
||||
|
||||
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
import { getAction } from '@/api/manage'
|
||||
<#list subTables as sub>
|
||||
import ${sub.entityName}List from './${sub.entityName}List'
|
||||
</#list>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if list_need_dict>
|
||||
import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: {
|
||||
<#list subTables as sub>
|
||||
${sub.entityName}List,
|
||||
</#list>
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
<#assign showColNum=0>
|
||||
<#list columns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='sel_tree' || po.classType=='sel_search' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart'>
|
||||
dataIndex: '${po.fieldName}_dictText',
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField != 'is_open'>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if list_need_category>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:(text)=>{
|
||||
if(!text){
|
||||
return ''
|
||||
}else{
|
||||
return filterMultiDictText(this.dictOptions['${po.fieldName}'], text+"")
|
||||
}
|
||||
}
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:(text,record)=>{
|
||||
if(!text){
|
||||
return ''
|
||||
}else{
|
||||
return record['${po.dictText}']
|
||||
}
|
||||
}
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/list",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
},
|
||||
dictOptions:{
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y')>
|
||||
<#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
${po.fieldName}:[],
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
/* 分页参数 */
|
||||
ipagination:{
|
||||
current: 1,
|
||||
pageSize: 5,
|
||||
pageSizeOptions: ['5', '10', '50'],
|
||||
showTotal: (total, range) => {
|
||||
return range[0] + "-" + range[1] + " 共" + total + "条"
|
||||
},
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
total: 0
|
||||
},
|
||||
selectedMainId:'',
|
||||
superFieldList:[],
|
||||
<#list subTables as sub>
|
||||
<#if sub?? && (sub.foreignMainKeys)??>
|
||||
<#list sub.foreignMainKeys as key>
|
||||
<#assign subMainFieldMap += {"${sub.entityName?uncap_first}MainId": "${dashedToCamel(key)}"}>
|
||||
</#list>
|
||||
${sub.entityName?uncap_first}MainId: '',
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
<#if po.classType='sel_depart'>
|
||||
initDictOptions('sys_depart,depart_name,id').then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
<#elseif po.classType=='cat_tree' && list_need_category==true>
|
||||
loadCategoryData({code:"${po.dictField}"}).then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
<#elseif po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
initDictOptions('${list_field_dictCode}').then((res) => {
|
||||
if (res.success) {
|
||||
this.$set(this.dictOptions, '${po.fieldName}', res.result)
|
||||
}
|
||||
})
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
clickThenSelect(record) {
|
||||
return {
|
||||
on: {
|
||||
click: () => {
|
||||
this.onSelectChange(record.id.split(","), [record]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onClearSelected() {
|
||||
this.selectedRowKeys = [];
|
||||
this.selectionRows = [];
|
||||
this.selectedMainId=''
|
||||
},
|
||||
onSelectChange(selectedRowKeys, selectionRows) {
|
||||
this.selectedMainId=selectedRowKeys[0]
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
this.selectionRows = selectionRows;
|
||||
<#list subMainFieldMap as key,value>
|
||||
this.${key} = selectionRows[0]['${value}']
|
||||
</#list>
|
||||
},
|
||||
loadData(arg) {
|
||||
if(!this.url.list){
|
||||
this.$message.error("请设置url.list属性!")
|
||||
return
|
||||
}
|
||||
//加载数据 若传入参数1则加载第一页的内容
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1;
|
||||
}
|
||||
this.onClearSelected()
|
||||
var params = this.getQueryParams();//查询条件
|
||||
this.loading = true;
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSource = res.result.records;
|
||||
this.ipagination.total = res.result.total;
|
||||
}
|
||||
if(res.code===510){
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
getSuperFieldList(){
|
||||
let fieldList=[];
|
||||
<#list columns as po>
|
||||
fieldList.push(${superQueryFieldList(po)})
|
||||
</#list>
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less'
|
||||
</style>
|
||||
@ -0,0 +1 @@
|
||||
<#include "/common/sql/menu_insert.ftl">
|
||||
@ -0,0 +1,327 @@
|
||||
<#list subTables as sub>
|
||||
#segment#${sub.entityName}List.vue
|
||||
<template>
|
||||
<a-card :bordered="false" :class="'cust-erp-sub-tab'">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_flag=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign subMainFieldMap={}>
|
||||
<#-- 开始循环 -->
|
||||
<#list sub.colums as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=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>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator" v-if="mainId">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('${sub.ftlDescription}')">导出</a-button>
|
||||
<a-upload
|
||||
name="file"
|
||||
:showUploadList="false"
|
||||
:multiple="false"
|
||||
:headers="tokenHeader"
|
||||
:action="importExcelUrl"
|
||||
@change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${sub.entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></${sub.entityName?uncap_first}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${sub.entityName}Modal from './modules/${sub.entityName}Modal'
|
||||
|
||||
export default {
|
||||
name: "${sub.entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: { ${sub.entityName}Modal },
|
||||
props:{
|
||||
mainId:{
|
||||
type:String,
|
||||
default:'',
|
||||
required:false
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
mainId:{
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if(!this.mainId){
|
||||
this.clearList()
|
||||
}else{
|
||||
<#list sub.foreignKeys as key>
|
||||
this.queryParam['${key?uncap_first}'] = val
|
||||
</#list>
|
||||
this.loadData(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: '${tableVo.ftlDescription}管理页面',
|
||||
disableMixinCreated:true,
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
<#assign showColNum=0>
|
||||
<#list sub.originalColumns as po>
|
||||
<#if po.isShowList =='Y'>
|
||||
<#assign showColNum=showColNum+1>
|
||||
{
|
||||
title:'${po.filedComment}',
|
||||
align:"center",
|
||||
<#if po.sort=='Y'>
|
||||
sorter: true,
|
||||
</#if>
|
||||
<#if po.classType=='date'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender:function (text) {
|
||||
return !text?"":(text.length>10?text.substr(0,10):text)
|
||||
}
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
dataIndex: '${po.fieldName}String'
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search' || po.classType =='cat_tree' || po.classType =='sel_depart'>
|
||||
dataIndex: '${po.fieldName}_dictText',
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
<#if po.dictField != 'is_open'>
|
||||
customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
|
||||
<#else>
|
||||
customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
|
||||
</#if>
|
||||
<#else>
|
||||
dataIndex: '${po.fieldName}'
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#list>
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}",
|
||||
importUrl: "/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}",
|
||||
},
|
||||
dictOptions:{
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y')>
|
||||
<#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
${po.fieldName}:[],
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl(){
|
||||
return `${'$'}{window._CONFIG['domianURL']}/${'$'}{this.url.importUrl}/${'$'}{this.mainId}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clearList(){
|
||||
this.dataSource=[]
|
||||
this.selectedRowKeys=[]
|
||||
this.ipagination.current = 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less'
|
||||
</style>
|
||||
</#list>
|
||||
@ -0,0 +1,212 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||
<a-row>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_span = 24>
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}" placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}" dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model="model.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<#elseif po.classType == 'sel_tree'>
|
||||
<j-tree-select
|
||||
ref="treeSelect"
|
||||
placeholder="请选择${po.filedComment}"
|
||||
v-model="model.${po.fieldName}"
|
||||
<#if po.dictText??>
|
||||
<#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>
|
||||
dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}"
|
||||
<#elseif po.dictText?split(',')[1]??>
|
||||
pidField="${po.dictText?split(',')[1]}"
|
||||
<#elseif po.dictText?split(',')[3]??>
|
||||
hasChildField="${po.dictText?split(',')[3]}"
|
||||
</#if>
|
||||
</#if>
|
||||
pidValue="${po.dictField}"
|
||||
<#if po.readonly=='Y'>disabled</#if>>
|
||||
</j-tree-select>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: "${entityName}Modal",
|
||||
components: {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:800,
|
||||
visible: false,
|
||||
model:{
|
||||
<#include "/common/init/initValue.ftl">
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit(this.modelDefault);
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.$refs.form.clearValidate();
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(backObj,this.model);
|
||||
}
|
||||
</#if>
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -0,0 +1,208 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#list subTables as sub>
|
||||
#segment#${sub.entityName}Modal.vue
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
||||
<a-row>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_span = 24>
|
||||
<#list sub.originalColumns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1 && po.dictText?default("")?trim?length gt 1 && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-model-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="${autoStringSuffixForModel(po)}">
|
||||
<#if po.classType =='date'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='time'>
|
||||
<j-time placeholder="请选择${po.filedComment}" v-model="model.${po.fieldName}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-model="model.${po.fieldName}"
|
||||
field="${po.fieldName}"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
:multi="${po.extendParams.popupMulti?c}"
|
||||
@input="popupCallback"
|
||||
<#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-select-depart v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if> />
|
||||
<#elseif po.classType =='switch'>
|
||||
<j-switch v-model="model.${po.fieldName}"<#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> <#if po.readonly=='Y'>disabled</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<j-area-linkage type="cascader" v-model="model.${po.fieldName}"placeholder="请输入省市区" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<j-markdown-editor v-model="model.${autoStringSuffixForModel(po)}" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-model="model.${po.fieldName}"placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<j-select-user-by-dep v-model="model.${po.fieldName}" :multi="${po.extendParams.multi?default('true')}"<#if po.extendParams.store?default("")?trim?length gt 0> store="${po.extendParams.store}"</#if><#if po.extendParams.text?default("")?trim?length gt 0> text="${po.extendParams.text}"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-model="model.${autoStringSuffixForModel(po)}" rows="4" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<j-dict-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<j-multi-select-tag type="${po.classType}" v-model="model.${po.fieldName}" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<j-search-select-tag v-model="model.${po.fieldName}"dict="${form_field_dictCode}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-model="model.${po.fieldName}"pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${dashedToCamel(po.dictText)}" @change="handleCategoryChange"</#if> <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-model="model.${po.fieldName}"placeholder="请输入${po.filedComment}" style="width: 100%" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.classType=='file'>
|
||||
<j-upload v-model="model.${po.fieldName}" <#if po.readonly=='Y'>disabled</#if> <#if po.uploadnum??>:number=${po.uploadnum}</#if>></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<j-image-upload isMultiple <#if po.uploadnum??>:number=${po.uploadnum}</#if> v-model="model.${po.fieldName}"<#if po.readonly=='Y'>disabled</#if>></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<j-editor v-model="model.${autoStringSuffixForModel(po)}" <#if po.readonly=='Y'>disabled</#if>/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-model="model.${autoStringSuffixForModel(po)}" placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
<#else>
|
||||
<a-input v-model="model.${po.fieldName}"placeholder="请输入${po.filedComment}" <#if po.readonly=='Y'>disabled</#if>></a-input>
|
||||
</#if>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: "${sub.entityName}Modal",
|
||||
components: {
|
||||
},
|
||||
props:{
|
||||
mainId:{
|
||||
type:String,
|
||||
required:false,
|
||||
default:''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:800,
|
||||
visible: false,
|
||||
model:{
|
||||
<#include "/common/init/initValueSub.ftl">
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/sub.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}",
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit(this.modelDefault);
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
this.$refs.form.clearValidate();
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
<#list sub.foreignKeys as key>
|
||||
this.model['${key?uncap_first}'] = this.mainId
|
||||
</#list>
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
<#if form_popup>
|
||||
popupCallback(value,row){
|
||||
this.model = Object.assign(this.model, row);
|
||||
},
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.model = Object.assign(this.model,backObj);
|
||||
}
|
||||
</#if>
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</#list>
|
||||
@ -0,0 +1,303 @@
|
||||
<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>
|
||||
<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="selectedRowKeys.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 #pcaSlot="{text}">
|
||||
{{ getAreaTextByCode(text) }}
|
||||
</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>
|
||||
<!--子表表格tab-->
|
||||
<a-tabs defaultActiveKey="1">
|
||||
<#assign sub_seq=1>
|
||||
<#list subTables as sub>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" key="${sub_seq}" <#if sub_seq gt 1>forceRender</#if>>
|
||||
<${sub.entityName}List/>
|
||||
</a-tab-pane>
|
||||
<#assign sub_seq=sub_seq+1>
|
||||
</#list>
|
||||
</a-tabs>
|
||||
<!-- 表单区域 -->
|
||||
<${entityName}Modal @register="registerModal" @success="handleSuccess"></${entityName}Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="${entityPackage}-${entityName?uncap_first}" setup>
|
||||
import {ref, computed, unref,provide} from 'vue';
|
||||
import {BasicTable, useTable, TableAction} from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage'
|
||||
import {useModal} from '/@/components/Modal';
|
||||
import ${entityName}Modal from './components/${entityName}Modal.vue'
|
||||
<#list subTables as sub>
|
||||
import ${sub.entityName}List from './${sub.entityName}List.vue'
|
||||
</#list>
|
||||
import {columns, searchFormSchema} from './${entityName}.data';
|
||||
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './${entityName}.api';
|
||||
import {downloadFile} from '/@/utils/common/renderUtils';
|
||||
<#if list_need_pca>
|
||||
import { getAreaTextByCode } from '/@/components/Form/src/utils/Area';
|
||||
</#if>
|
||||
<#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>
|
||||
<#if bpm_flag==true>
|
||||
import { startProcess } from '/@/api/common/api';
|
||||
</#if>
|
||||
//注册model
|
||||
const [registerModal, {openModal}] = useModal();
|
||||
//注册table数据
|
||||
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
title: '${tableVo.ftlDescription}',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
rowSelection: {type: 'radio'},
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToNumber: [
|
||||
<#list columns as po>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#if po.queryMode!='single'>
|
||||
<#if po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
['${po.fieldName}', ['${po.fieldName}_begin', '${po.fieldName}_end']],
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
],
|
||||
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>
|
||||
],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
fixed:'right'
|
||||
},
|
||||
pagination:{
|
||||
current: 1,
|
||||
pageSize: 5,
|
||||
pageSizeOptions: ['5', '10', '20'],
|
||||
}
|
||||
},
|
||||
exportConfig: {
|
||||
name:"${tableVo.ftlDescription}",
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess
|
||||
},
|
||||
})
|
||||
|
||||
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
||||
|
||||
const mainId = computed(() => (unref(selectedRowKeys).length > 0 ? unref(selectedRowKeys)[0] : ''));
|
||||
//下发 mainId,子组件接收
|
||||
provide('mainId', mainId);
|
||||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
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}, handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ids: selectedRowKeys.value},handleSuccess);
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
}
|
||||
/**
|
||||
* 操作栏
|
||||
*/
|
||||
function getTableAction(record){
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
<#if bpm_flag==true>
|
||||
/**
|
||||
* 提交流程
|
||||
*/
|
||||
async function handleProcess(record) {
|
||||
let params = {
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
await startProcess(params);
|
||||
handleSuccess();
|
||||
}
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* 下拉操作栏
|
||||
*/
|
||||
function getDropDownAction(record){
|
||||
<#if bpm_flag==true>
|
||||
let dropDownAction = [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
];
|
||||
if(record.bpmStatus == '1'){
|
||||
dropDownAction.push({
|
||||
label: '发起流程',
|
||||
popConfirm: {
|
||||
title: '确认提交流程吗?',
|
||||
confirm: handleProcess.bind(null, record),
|
||||
}
|
||||
})
|
||||
}
|
||||
return dropDownAction;
|
||||
<#else>
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
}
|
||||
}
|
||||
]
|
||||
</#if>
|
||||
}
|
||||
|
||||
<#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,133 @@
|
||||
import {defHttp} from '/@/utils/http/axios';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
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}/list${sub.entityName}ByMainId',
|
||||
${sub.entityName?uncap_first}Save='/${entityPackage}/${entityName?uncap_first}/add${sub.entityName}',
|
||||
${sub.entityName?uncap_first}Edit='/${entityPackage}/${entityName?uncap_first}/edit${sub.entityName}',
|
||||
${sub.entityName?uncap_first}Delete = '/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}',
|
||||
${sub.entityName?uncap_first}DeleteBatch = '/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}',
|
||||
</#list>
|
||||
}
|
||||
/**
|
||||
* 导出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) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
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});
|
||||
}
|
||||
<#list subTables as sub><#rt/>
|
||||
<#assign myForeignKeys=''>
|
||||
<#list sub.foreignKeys as key>
|
||||
<#assign myForeignKeys='${key?uncap_first}'>
|
||||
</#list>
|
||||
/**
|
||||
* 列表接口
|
||||
* @param params
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}List = (params) => {
|
||||
if(params['${myForeignKeys}']){
|
||||
return defHttp.get({url: Api.${sub.entityName?uncap_first}List, params});
|
||||
}
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除单个
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}Delete = (params,handleSuccess) => {
|
||||
return defHttp.delete({url: Api.${sub.entityName?uncap_first}Delete, params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}DeleteBatch = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({url: Api.${sub.entityName?uncap_first}DeleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 保存或者更新
|
||||
* @param params
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}SaveOrUpdate = (params, isUpdate) => {
|
||||
let url = isUpdate ? Api.${sub.entityName?uncap_first}Edit : Api.${sub.entityName?uncap_first}Save;
|
||||
return defHttp.post({url: url, params});
|
||||
}
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}ImportUrl = '/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}'
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
export const ${sub.entityName?uncap_first}ExportXlsUrl = '/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}'
|
||||
</#list>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user