Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
8d8172b8
Commit
8d8172b8
authored
Nov 17, 2022
by
蒋凌峰
😉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
17918784
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1620 additions
and
803 deletions
+1620
-803
ruoyi-admin/src/main/java/com/ruoyi/web/controller/finance/FncSubjectTypeController.java
...uoyi/web/controller/finance/FncSubjectTypeController.java
+91
-0
ruoyi-admin/src/main/resources/application-druid.yml
ruoyi-admin/src/main/resources/application-druid.yml
+1
-1
ruoyi-common/pom.xml
ruoyi-common/pom.xml
+6
-0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
...rc/main/java/com/ruoyi/common/core/domain/BaseEntity.java
+2
-0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java
...on/src/main/java/com/ruoyi/common/core/page/PagePlus.java
+156
-0
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
...c/main/java/com/ruoyi/common/core/page/TableDataInfo.java
+33
-58
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
...ommon/src/main/java/com/ruoyi/common/utils/PageUtils.java
+127
-7
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
...src/main/java/com/ruoyi/generator/util/VelocityUtils.java
+74
-124
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
...i-generator/src/main/resources/vm/java/controller.java.vm
+58
-75
ruoyi-generator/src/main/resources/vm/js/api.js.vm
ruoyi-generator/src/main/resources/vm/js/api.js.vm
+15
-6
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
+532
-529
ruoyi-system/src/main/java/com/ruoyi/system/domain/FncSubjectType.java
...src/main/java/com/ruoyi/system/domain/FncSubjectType.java
+50
-0
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/FncSubjectTypeVo.java
...ain/java/com/ruoyi/system/domain/vo/FncSubjectTypeVo.java
+23
-0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/FncSubjectTypeMapper.java
...in/java/com/ruoyi/system/mapper/FncSubjectTypeMapper.java
+25
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/IFncSubjectTypeService.java
...java/com/ruoyi/system/service/IFncSubjectTypeService.java
+41
-0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FncSubjectTypeServiceImpl.java
.../ruoyi/system/service/impl/FncSubjectTypeServiceImpl.java
+37
-0
ruoyi-system/src/main/resources/mapper/finance/FncSubjectTypeMapper.xml
...rc/main/resources/mapper/finance/FncSubjectTypeMapper.xml
+40
-0
ruoyi-ui/src/api/finance/subjectType.js
ruoyi-ui/src/api/finance/subjectType.js
+44
-0
ruoyi-ui/src/views/finance/ledger/index.vue
ruoyi-ui/src/views/finance/ledger/index.vue
+3
-3
ruoyi-ui/src/views/finance/subjecttype/index.vue
ruoyi-ui/src/views/finance/subjecttype/index.vue
+262
-0
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/finance/FncSubjectTypeController.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.controller
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.FncSubjectType
;
import
com.ruoyi.system.domain.vo.FncSubjectTypeVo
;
import
com.ruoyi.system.service.IFncSubjectTypeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 科目类别Controller
*
* @author jlf
* @date 2022-11-17
*/
@Api
(
tags
=
"科目类别Controller"
)
@RestController
@RequestMapping
(
"/finance/subjectType"
)
//@RequiredArgsConstructor(onConstructor = @Autowired)
public
class
FncSubjectTypeController
extends
BaseController
{
@Autowired
private
IFncSubjectTypeService
fncSubjectTypeService
;
@ApiOperation
(
"查询科目类别列表"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
<
FncSubjectTypeVo
>
list
(
FncSubjectTypeVo
entity
)
{
return
fncSubjectTypeService
.
queryList
(
entity
);
}
@ApiOperation
(
"查询科目类别所有列表"
)
@GetMapping
(
"/listAll"
)
public
AjaxResult
listAll
(
FncSubjectTypeVo
entity
)
{
return
AjaxResult
.
success
(
"查询成功"
,
fncSubjectTypeService
.
queryAll
(
entity
));
}
@ApiOperation
(
"导出科目类别列表"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:export')"
)
@Log
(
title
=
"科目类别"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
FncSubjectTypeVo
entity
)
{
List
<
FncSubjectTypeVo
>
list
=
fncSubjectTypeService
.
queryAll
(
entity
);
ExcelUtil
<
FncSubjectTypeVo
>
util
=
new
ExcelUtil
<>(
FncSubjectTypeVo
.
class
);
util
.
exportExcel
(
response
,
list
,
"科目类别数据"
);
}
@ApiOperation
(
"获取科目类别详细信息"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:query')"
)
@GetMapping
(
value
=
"/getInfo/{subjectTypeId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"subjectTypeId"
)
Long
subjectTypeId
)
{
return
AjaxResult
.
success
(
"查询成功"
,
fncSubjectTypeService
.
queryById
(
subjectTypeId
));
}
@ApiOperation
(
"新增科目类别"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:add')"
)
@Log
(
title
=
"科目类别"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"add"
)
public
AjaxResult
add
(
@RequestBody
FncSubjectType
entity
)
{
return
toAjax
(
fncSubjectTypeService
.
save
(
entity
));
}
@ApiOperation
(
"修改科目类别"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:edit')"
)
@Log
(
title
=
"科目类别"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"edit"
)
public
AjaxResult
edit
(
@RequestBody
FncSubjectType
entity
)
{
return
toAjax
(
fncSubjectTypeService
.
updateById
(
entity
));
}
@ApiOperation
(
"删除科目类别"
)
@PreAuthorize
(
"@ss.hasPermi('finance:subjectType:remove')"
)
@Log
(
title
=
"科目类别"
,
businessType
=
BusinessType
.
DELETE
)
@GetMapping
(
"/remove/{subjectTypeIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
subjectTypeIds
)
{
return
toAjax
(
fncSubjectTypeService
.
removeByIds
(
Arrays
.
asList
(
subjectTypeIds
))
?
1
:
0
);
}
}
ruoyi-admin/src/main/resources/application-druid.yml
View file @
8d8172b8
...
...
@@ -6,7 +6,7 @@ spring:
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://
192.168.182.130
:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://
localhost
:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
root
# 从库数据源
...
...
ruoyi-common/pom.xml
View file @
8d8172b8
...
...
@@ -146,6 +146,12 @@
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-annotations
</artifactId>
<version>
1.6.2
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
...
...
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
View file @
8d8172b8
...
...
@@ -49,6 +49,8 @@ public class BaseEntity implements Serializable {
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
/**
* 请求参数
*/
...
...
ruoyi-common/src/main/java/com/ruoyi/common/core/page/PagePlus.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.common.core.page
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
/**
* 分页 Page 增强对象
*
* @param <T> 数据库实体
* @param <K> vo实体
* @author Lion Li
*/
@Data
@Accessors
(
chain
=
true
)
public
class
PagePlus
<
T
,
K
>
implements
IPage
<
T
>
{
/**
* domain实体列表
*/
private
List
<
T
>
records
=
Collections
.
emptyList
();
/**
* vo实体列表
*/
private
List
<
K
>
recordsVo
=
Collections
.
emptyList
();
/**
* 总数
*/
private
long
total
=
0L
;
/**
* 页长度
*/
private
long
size
=
10L
;
/**
* 当前页
*/
private
long
current
=
1L
;
/**
* 排序字段信息
*/
private
List
<
OrderItem
>
orders
=
new
ArrayList
<>();
/**
* 自动优化 COUNT SQL
*/
private
boolean
optimizeCountSql
=
true
;
/**
* 是否进行 count 查询
*/
private
boolean
isSearchCount
=
true
;
/**
* 是否命中count缓存
*/
private
boolean
hitCount
=
false
;
/**
* countId
*/
private
String
countId
;
/**
* 最大limit
*/
private
Long
maxLimit
;
public
PagePlus
()
{
}
public
PagePlus
(
long
current
,
long
size
)
{
this
(
current
,
size
,
0L
);
}
public
PagePlus
(
long
current
,
long
size
,
long
total
)
{
this
(
current
,
size
,
total
,
true
);
}
public
PagePlus
(
long
current
,
long
size
,
boolean
isSearchCount
)
{
this
(
current
,
size
,
0L
,
isSearchCount
);
}
public
PagePlus
(
long
current
,
long
size
,
long
total
,
boolean
isSearchCount
)
{
if
(
current
>
1L
)
{
this
.
current
=
current
;
}
this
.
size
=
size
;
this
.
total
=
total
;
this
.
isSearchCount
=
isSearchCount
;
}
public
static
<
T
,
K
>
PagePlus
<
T
,
K
>
of
(
long
current
,
long
size
)
{
return
of
(
current
,
size
,
0
);
}
public
static
<
T
,
K
>
PagePlus
<
T
,
K
>
of
(
long
current
,
long
size
,
long
total
)
{
return
of
(
current
,
size
,
total
,
true
);
}
public
static
<
T
,
K
>
PagePlus
<
T
,
K
>
of
(
long
current
,
long
size
,
boolean
searchCount
)
{
return
of
(
current
,
size
,
0
,
searchCount
);
}
public
static
<
T
,
K
>
PagePlus
<
T
,
K
>
of
(
long
current
,
long
size
,
long
total
,
boolean
searchCount
)
{
return
new
PagePlus
<>(
current
,
size
,
total
,
searchCount
);
}
@Override
public
String
countId
()
{
return
this
.
getCountId
();
}
@Override
public
Long
maxLimit
()
{
return
this
.
getMaxLimit
();
}
public
PagePlus
<
T
,
K
>
addOrder
(
OrderItem
...
items
)
{
this
.
orders
.
addAll
(
Arrays
.
asList
(
items
));
return
this
;
}
public
PagePlus
<
T
,
K
>
addOrder
(
List
<
OrderItem
>
items
)
{
this
.
orders
.
addAll
(
items
);
return
this
;
}
@Override
public
List
<
OrderItem
>
orders
()
{
return
this
.
getOrders
();
}
@Override
public
boolean
optimizeCountSql
()
{
return
this
.
optimizeCountSql
;
}
@Override
public
long
getPages
()
{
// 解决 github issues/3208
return
IPage
.
super
.
getPages
();
}
}
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java
View file @
8d8172b8
package
com.ruoyi.common.core.page
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 表格分页数据对象
*
* @author
ruoy
i
* @author
Lion L
i
*/
public
class
TableDataInfo
implements
Serializable
{
@Data
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@ApiModel
(
"分页响应对象"
)
public
class
TableDataInfo
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 总记录数 */
/**
* 总记录数
*/
@ApiModelProperty
(
"总记录数"
)
private
long
total
;
/** 列表数据 */
private
List
<?>
rows
;
/**
* 列表数据
*/
@ApiModelProperty
(
"列表数据"
)
private
List
<
T
>
rows
;
/** 消息状态码 */
/**
* 消息状态码
*/
@ApiModelProperty
(
"消息状态码"
)
private
int
code
;
/** 消息内容 */
private
String
msg
;
/**
*
表格数据对象
*
消息内容
*/
public
TableDataInfo
()
{
}
@ApiModelProperty
(
"消息内容"
)
private
String
msg
;
/**
* 分页
...
...
@@ -37,49 +52,9 @@ public class TableDataInfo implements Serializable
* @param list 列表数据
* @param total 总记录数
*/
public
TableDataInfo
(
List
<?>
list
,
int
total
)
{
public
TableDataInfo
(
List
<
T
>
list
,
long
total
)
{
this
.
rows
=
list
;
this
.
total
=
total
;
}
public
long
getTotal
()
{
return
total
;
}
public
void
setTotal
(
long
total
)
{
this
.
total
=
total
;
}
public
List
<?>
getRows
()
{
return
rows
;
}
public
void
setRows
(
List
<?>
rows
)
{
this
.
rows
=
rows
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java
View file @
8d8172b8
package
com.ruoyi.common.utils
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.http.HttpStatus
;
import
com.baomidou.mybatisplus.core.metadata.OrderItem
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.ruoyi.common.core.page.PageDomain
;
import
com.ruoyi.common.core.page.PagePlus
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.core.page.TableSupport
;
import
com.ruoyi.common.utils.sql.SqlUtil
;
import
java.util.List
;
/**
* 分页工具类
*
* @author ruoyi
*/
public
class
PageUtils
extends
PageHelper
{
public
class
PageUtils
extends
PageHelper
{
/**
* 设置请求分页数据
*/
public
static
void
startPage
()
{
public
static
void
startPage
()
{
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
...
...
@@ -28,8 +34,122 @@ public class PageUtils extends PageHelper
/**
* 清理分页的线程变量
*/
public
static
void
clearPage
()
{
public
static
void
clearPage
()
{
PageHelper
.
clearPage
();
}
/**
* 当前记录起始索引
*/
public
static
final
String
PAGE_NUM
=
"pageNum"
;
/**
* 每页显示记录数
*/
public
static
final
String
PAGE_SIZE
=
"pageSize"
;
/**
* 排序列
*/
public
static
final
String
ORDER_BY_COLUMN
=
"orderByColumn"
;
/**
* 排序的方向 "desc" 或者 "asc".
*/
public
static
final
String
IS_ASC
=
"isAsc"
;
/**
* 当前记录起始索引 默认值
*/
public
static
final
int
DEFAULT_PAGE_NUM
=
1
;
/**
* 每页显示记录数 默认值 默认查全部
*/
public
static
final
int
DEFAULT_PAGE_SIZE
=
Integer
.
MAX_VALUE
;
/**
* 构建 plus 分页对象
*
* @param <T> domain 实体
* @param <K> vo 实体
* @return 分页对象
*/
public
static
<
T
,
K
>
PagePlus
<
T
,
K
>
buildPagePlus
()
{
Integer
pageNum
=
ServletUtils
.
getParameterToInt
(
PAGE_NUM
,
DEFAULT_PAGE_NUM
);
Integer
pageSize
=
ServletUtils
.
getParameterToInt
(
PAGE_SIZE
,
DEFAULT_PAGE_SIZE
);
String
orderByColumn
=
ServletUtils
.
getParameter
(
ORDER_BY_COLUMN
);
String
isAsc
=
ServletUtils
.
getParameter
(
IS_ASC
);
PagePlus
<
T
,
K
>
page
=
new
PagePlus
<>(
pageNum
,
pageSize
);
if
(
StrUtil
.
isNotBlank
(
orderByColumn
))
{
String
orderBy
=
SqlUtil
.
escapeOrderBySql
(
orderByColumn
);
if
(
"asc"
.
equals
(
isAsc
))
{
page
.
addOrder
(
OrderItem
.
asc
(
orderBy
));
}
else
if
(
"desc"
.
equals
(
isAsc
))
{
page
.
addOrder
(
OrderItem
.
desc
(
orderBy
));
}
}
return
page
;
}
public
static
<
T
>
Page
<
T
>
buildPage
()
{
return
buildPage
(
null
,
null
);
}
/**
* 构建 MP 普通分页对象
*
* @param <T> domain 实体
* @return 分页对象
*/
public
static
<
T
>
Page
<
T
>
buildPage
(
String
defaultOrderByColumn
,
String
defaultIsAsc
)
{
Integer
pageNum
=
ServletUtils
.
getParameterToInt
(
PAGE_NUM
,
DEFAULT_PAGE_NUM
);
Integer
pageSize
=
ServletUtils
.
getParameterToInt
(
PAGE_SIZE
,
DEFAULT_PAGE_SIZE
);
String
orderByColumn
=
ServletUtils
.
getParameter
(
ORDER_BY_COLUMN
,
defaultOrderByColumn
);
String
isAsc
=
ServletUtils
.
getParameter
(
IS_ASC
,
defaultIsAsc
);
// 兼容前端排序类型
if
(
"ascending"
.
equals
(
isAsc
))
{
isAsc
=
"asc"
;
}
else
if
(
"descending"
.
equals
(
isAsc
))
{
isAsc
=
"desc"
;
}
Page
<
T
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
if
(
StrUtil
.
isNotBlank
(
orderByColumn
))
{
String
orderBy
=
SqlUtil
.
escapeOrderBySql
(
orderByColumn
);
orderBy
=
StrUtil
.
toUnderlineCase
(
orderBy
);
if
(
"asc"
.
equals
(
isAsc
))
{
page
.
addOrder
(
OrderItem
.
asc
(
orderBy
));
}
else
if
(
"desc"
.
equals
(
isAsc
))
{
page
.
addOrder
(
OrderItem
.
desc
(
orderBy
));
}
}
return
page
;
}
public
static
<
T
,
K
>
TableDataInfo
<
K
>
buildDataInfo
(
PagePlus
<
T
,
K
>
page
)
{
TableDataInfo
<
K
>
rspData
=
new
TableDataInfo
<>();
rspData
.
setCode
(
HttpStatus
.
HTTP_OK
);
rspData
.
setMsg
(
"查询成功"
);
rspData
.
setRows
(
page
.
getRecordsVo
());
rspData
.
setTotal
(
page
.
getTotal
());
return
rspData
;
}
public
static
<
T
>
TableDataInfo
<
T
>
buildDataInfo
(
Page
<
T
>
page
)
{
TableDataInfo
<
T
>
rspData
=
new
TableDataInfo
<>();
rspData
.
setCode
(
HttpStatus
.
HTTP_OK
);
rspData
.
setMsg
(
"查询成功"
);
rspData
.
setRows
(
page
.
getRecords
());
rspData
.
setTotal
(
page
.
getTotal
());
return
rspData
;
}
public
static
<
T
>
TableDataInfo
<
T
>
buildDataInfo
(
List
<
T
>
list
)
{
TableDataInfo
<
T
>
rspData
=
new
TableDataInfo
<>();
rspData
.
setCode
(
HttpStatus
.
HTTP_OK
);
rspData
.
setMsg
(
"查询成功"
);
rspData
.
setRows
(
list
);
rspData
.
setTotal
(
list
.
size
());
return
rspData
;
}
}
ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
View file @
8d8172b8
This diff is collapsed.
Click to expand it.
ruoyi-generator/src/main/resources/vm/java/controller.java.vm
View file @
8d8172b8
package
${
packageName
}.
controller
;
import
java
.
util
.
List
;
import
javax
.
servlet
.
http
.
HttpServletResponse
;
import
org
.
springframework
.
security
.
access
.
prepost
.
PreAuthorize
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
GetMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
PostMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
PutMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
DeleteMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
PathVariable
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestBody
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMapping
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RestController
;
import
com
.
ruoyi
.
common
.
annotation
.
Log
;
import
com
.
ruoyi
.
common
.
core
.
controller
.
BaseController
;
import
com
.
ruoyi
.
common
.
core
.
domain
.
AjaxResult
;
import
com
.
ruoyi
.
common
.
enums
.
BusinessType
;
import
${
packageName
}.
domain
.${
ClassName
};
import
${
packageName
}.
service
.
I
${
ClassName
}
Service
;
import
com
.
ruoyi
.
common
.
utils
.
poi
.
ExcelUtil
;
#
if
($
table
.
crud
||
$
table
.
sub
)
import
com
.
ruoyi
.
common
.
core
.
page
.
TableDataInfo
;
#
elseif
($
table
.
tree
)
#
end
import
${
packageName
}.
vo
.${
ClassName
}
Vo
;
import
${
packageName
}.
service
.
I
${
ClassName
}
Service
;
import
io
.
swagger
.
annotations
.
Api
;
import
io
.
swagger
.
annotations
.
ApiOperation
;
import
lombok
.
RequiredArgsConstructor
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
security
.
access
.
prepost
.
PreAuthorize
;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
#
if
($
table
.
crud
||
$
table
.
sub
)
import
com
.
ruoyi
.
common
.
core
.
page
.
TableDataInfo
;
#
elseif
($
table
.
tree
)
#
end
import
javax
.
servlet
.
http
.
HttpServletResponse
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
List
;
/**
*
${
functionName
}
Controller
...
...
@@ -30,86 +28,71 @@ import com.ruoyi.common.core.page.TableDataInfo;
*
@
author
${
author
}
*
@
date
${
datetime
}
*/
@
Api
(
tags
=
"${functionName}Controller"
)
@
RestController
@
RequestMapping
(
"/${moduleName}/${businessName}"
)
public
class
${
ClassName
}
Controller
extends
BaseController
{
@
Autowired
private
I
${
ClassName
}
Service
${
className
}
Service
;
@
RequiredArgsConstructor
(
onConstructor_
=
@
Autowired
)
public
class
${
ClassName
}
Controller
extends
BaseController
{
/**
*
查询
${
functionName
}
列表
*/
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:list')"
)
@
GetMapping
(
"/list"
)
#
if
($
table
.
crud
||
$
table
.
sub
)
public
TableDataInfo
list
(${
ClassName
}
${
className
})
{
startPage
();
List
<${
ClassName
}>
list
=
${
className
}
Service
.
select
${
ClassName
}
List
(${
className
});
return
getDataTable
(
list
);
private
final
I
${
ClassName
}
Service
${
className
}
Service
;
@
ApiOperation
(
"查询${functionName}列表"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:list')"
)
@
GetMapping
(
"/list"
)
#
if
($
table
.
crud
||
$
table
.
sub
)
public
TableDataInfo
<${
ClassName
}
Vo
>
list
(${
ClassName
}
Vo
entity
)
{
return
${
className
}
Service
.
queryList
(
entity
);
}
#
elseif
($
table
.
tree
)
public
AjaxResult
list
(${
ClassName
}
${
className
})
{
List
<${
ClassName
}>
list
=
${
className
}
Service
.
select
${
ClassName
}
List
(${
className
});
return
success
(
list
);
#
elseif
($
table
.
tree
)
public
AjaxResult
list
(${
ClassName
}
Vo
entity
)
{
return
AjaxResult
.
success
(
"查询成功"
,
${
className
}
Service
.
queryAll
(
entity
));
}
#
end
#
end
/**
*
导出
${
functionName
}
列表
*/
@
ApiOperation
(
"查询${functionName}所有列表"
)
@
GetMapping
(
"/listAll"
)
public
AjaxResult
listAll
(${
ClassName
}
Vo
entity
)
{
return
AjaxResult
.
success
(
"查询成功"
,
${
className
}
Service
.
queryAll
(
entity
));
}
@
ApiOperation
(
"导出${functionName}列表"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:export')"
)
@
Log
(
title
=
"${functionName}"
,
businessType
=
BusinessType
.
EXPORT
)
@
PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
${
ClassName
}
${
className
})
{
List
<${
ClassName
}>
list
=
${
className
}
Service
.
select
${
ClassName
}
List
(${
className
});
ExcelUtil
<${
ClassName
}>
util
=
new
ExcelUtil
<${
ClassName
}>(${
ClassName
}.
class
);
public
void
export
(
HttpServletResponse
response
,
${
ClassName
}
Vo
entity
)
{
List
<${
ClassName
}
Vo
>
list
=
${
className
}
Service
.
queryAll
(
entity
);
ExcelUtil
<${
ClassName
}
Vo
>
util
=
new
ExcelUtil
<>(${
ClassName
}
Vo
.
class
);
util
.
exportExcel
(
response
,
list
,
"${functionName}数据"
);
}
/**
*
获取
${
functionName
}
详细信息
*/
@
ApiOperation
(
"获取${functionName}详细信息"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:query')"
)
@
GetMapping
(
value
=
"/{${pkColumn.javaField}}"
)
public
AjaxResult
getInfo
(@
PathVariable
(
"${pkColumn.javaField}"
)
${
pkColumn
.
javaType
}
${
pkColumn
.
javaField
})
{
return
success
(${
className
}
Service
.
select
${
ClassName
}
By
${
pkColumn
.
capJavaField
}(${
pkColumn
.
javaField
}));
@
GetMapping
(
value
=
"/getInfo/{${pkColumn.javaField}}"
)
public
AjaxResult
getInfo
(@
PathVariable
(
"${pkColumn.javaField}"
)
${
pkColumn
.
javaType
}
${
pkColumn
.
javaField
})
{
return
AjaxResult
.
success
(
"查询成功"
,
${
className
}
Service
.
queryById
(${
pkColumn
.
javaField
}));
}
/**
*
新增
${
functionName
}
*/
@
ApiOperation
(
"新增${functionName}"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:add')"
)
@
Log
(
title
=
"${functionName}"
,
businessType
=
BusinessType
.
INSERT
)
@
PostMapping
public
AjaxResult
add
(@
RequestBody
${
ClassName
}
${
className
})
{
return
toAjax
(${
className
}
Service
.
insert
${
ClassName
}(${
className
}));
@
PostMapping
(
"add"
)
public
AjaxResult
add
(@
RequestBody
${
ClassName
}
Vo
entity
)
{
return
toAjax
(${
className
}
Service
.
save
(
entity
));
}
/**
*
修改
${
functionName
}
*/
@
ApiOperation
(
"修改${functionName}"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:edit')"
)
@
Log
(
title
=
"${functionName}"
,
businessType
=
BusinessType
.
UPDATE
)
@
PutMapping
public
AjaxResult
edit
(@
RequestBody
${
ClassName
}
${
className
})
{
return
toAjax
(${
className
}
Service
.
update
${
ClassName
}(${
className
}));
@
PostMapping
(
"edit"
)
public
AjaxResult
edit
(@
RequestBody
${
ClassName
}
Vo
entity
)
{
return
toAjax
(${
className
}
Service
.
updateById
(
entity
));
}
/**
*
删除
${
functionName
}
*/
@
ApiOperation
(
"删除${functionName}"
)
@
PreAuthorize
(
"@ss.hasPermi('${permissionPrefix}:remove')"
)
@
Log
(
title
=
"${functionName}"
,
businessType
=
BusinessType
.
DELETE
)
@
DeleteMapping
(
"/{${pkColumn.javaField}s}"
)
public
AjaxResult
remove
(@
PathVariable
${
pkColumn
.
javaType
}[]
${
pkColumn
.
javaField
}
s
)
{
return
toAjax
(${
className
}
Service
.
delete
${
ClassName
}
By
${
pkColumn
.
capJavaField
}
s
(${
pkColumn
.
javaField
}
s
));
@
GetMapping
(
"/remove/{${pkColumn.javaField}s}"
)
public
AjaxResult
remove
(@
PathVariable
${
pkColumn
.
javaType
}[]
${
pkColumn
.
javaField
}
s
)
{
return
toAjax
(${
className
}
Service
.
removeByIds
(
Arrays
.
asList
(
ids
))
?
1
:
0
);
}
}
ruoyi-generator/src/main/resources/vm/js/api.js.vm
View file @
8d8172b8
...
...
@@ -9,10 +9,19 @@ export function list${BusinessName}(query) {
})
}
// 查询${functionName}所有列表
export function listAll${BusinessName}(query) {
return request({
url: '/${moduleName}/${businessName}/listAll',
method: 'get',
params: query
})
}
// 查询${functionName}详细
export function get${BusinessName}(${pkColumn.javaField}) {
return request({
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
url: '/${moduleName}/${businessName}/
getInfo/
' + ${pkColumn.javaField},
method: 'get'
})
}
...
...
@@ -20,7 +29,7 @@ export function get${BusinessName}(${pkColumn.javaField}) {
// 新增${functionName}
export function add${BusinessName}(data) {
return request({
url: '/${moduleName}/${businessName}',
url: '/${moduleName}/${businessName}
/add
',
method: 'post',
data: data
})
...
...
@@ -29,8 +38,8 @@ export function add${BusinessName}(data) {
// 修改${functionName}
export function update${BusinessName}(data) {
return request({
url: '/${moduleName}/${businessName}',
method: 'p
u
t',
url: '/${moduleName}/${businessName}
/edit
',
method: 'p
os
t',
data: data
})
}
...
...
@@ -38,7 +47,7 @@ export function update${BusinessName}(data) {
// 删除${functionName}
export function del${BusinessName}(${pkColumn.javaField}) {
return request({
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
method: '
delete
'
url: '/${moduleName}/${businessName}/
remove/
' + ${pkColumn.javaField},
method: '
get
'
})
}
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm
View file @
8d8172b8
This diff is collapsed.
Click to expand it.
ruoyi-system/src/main/java/com/ruoyi/system/domain/FncSubjectType.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.domain
;
import
com.ruoyi.common.annotation.Excel
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.ruoyi.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
import
lombok.experimental.Accessors
;
/**
* 科目类别对象 fnc_subject_type
*
* @author jlf
* @date 2022-11-17
*/
@Data
@Accessors
(
chain
=
true
)
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
FncSubjectType
extends
BaseEntity
{
/**
* 科目类别id
*/
private
Long
subjectTypeId
;
/**
* 上级id
*/
@Excel
(
name
=
"上级id"
)
private
Long
parentId
;
/**
* 科目类别名称
*/
@Excel
(
name
=
"科目类别名称"
)
private
String
subjectTypeName
;
/**
* 显示顺序
*/
@Excel
(
name
=
"显示顺序"
)
private
Integer
orderNum
;
private
Integer
deleteStatus
;
}
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/FncSubjectTypeVo.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.domain.vo
;
import
com.ruoyi.common.core.domain.BaseEntity
;
import
com.ruoyi.system.domain.FncSubjectType
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.ToString
;
import
lombok.experimental.Accessors
;
/**
* 科目类别对象 fnc_subject_type
*
* @author jlf
* @date 2022-11-17
*/
@Data
@Accessors
(
chain
=
true
)
@ToString
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
FncSubjectTypeVo
extends
FncSubjectType
{
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/FncSubjectTypeMapper.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.ruoyi.system.domain.FncSubjectType
;
import
com.ruoyi.system.domain.vo.FncSubjectTypeVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 科目类别Mapper接口
*
* @author jlf
* @date 2022-11-17
*/
public
interface
FncSubjectTypeMapper
extends
BaseMapper
<
FncSubjectType
>
{
Page
<
FncSubjectTypeVo
>
queryList
(
Page
<?>
page
,
@Param
(
"entity"
)
FncSubjectTypeVo
entity
);
List
<
FncSubjectTypeVo
>
queryList
(
@Param
(
"entity"
)
FncSubjectTypeVo
entity
);
FncSubjectTypeVo
queryById
(
@Param
(
"id"
)
Long
subjectTypeId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/IFncSubjectTypeService.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.system.domain.FncSubjectType
;
import
com.ruoyi.system.domain.vo.FncSubjectTypeVo
;
import
java.util.List
;
/**
* 科目类别Service接口
*
* @author jlf
* @date 2022-11-17
*/
public
interface
IFncSubjectTypeService
extends
IService
<
FncSubjectType
>
{
/**
* 分页查询
*
* @param entity
* @return
*/
TableDataInfo
<
FncSubjectTypeVo
>
queryList
(
FncSubjectTypeVo
entity
);
/**
* 查询全部
*
* @param entity
* @return
*/
List
<
FncSubjectTypeVo
>
queryAll
(
FncSubjectTypeVo
entity
);
/**
* 根据ID查询
*
* @param subjectTypeId
* @return
*/
FncSubjectTypeVo
queryById
(
Long
subjectTypeId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/FncSubjectTypeServiceImpl.java
0 → 100644
View file @
8d8172b8
package
com.ruoyi.system.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.utils.PageUtils
;
import
com.ruoyi.system.domain.FncSubjectType
;
import
com.ruoyi.system.domain.vo.FncSubjectTypeVo
;
import
com.ruoyi.system.mapper.FncSubjectTypeMapper
;
import
com.ruoyi.system.service.IFncSubjectTypeService
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 科目类别Service业务层处理
*
* @author jlf
* @date 2022-11-17
*/
@Service
public
class
FncSubjectTypeServiceImpl
extends
ServiceImpl
<
FncSubjectTypeMapper
,
FncSubjectType
>
implements
IFncSubjectTypeService
{
@Override
public
TableDataInfo
<
FncSubjectTypeVo
>
queryList
(
FncSubjectTypeVo
entity
)
{
return
PageUtils
.
buildDataInfo
(
this
.
baseMapper
.
queryList
(
PageUtils
.
buildPage
(),
entity
));
}
@Override
public
List
<
FncSubjectTypeVo
>
queryAll
(
FncSubjectTypeVo
entity
)
{
return
this
.
baseMapper
.
queryList
(
entity
);
}
@Override
public
FncSubjectTypeVo
queryById
(
Long
subjectTypeId
)
{
return
this
.
baseMapper
.
queryById
(
subjectTypeId
);
}
}
ruoyi-system/src/main/resources/mapper/finance/FncSubjectTypeMapper.xml
0 → 100644
View file @
8d8172b8
<?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=
"com.ruoyi.system.mapper.FncSubjectTypeMapper"
>
<sql
id=
"querySql"
>
select
<include
refid=
"allField"
/>
from fnc_subject_type A
<include
refid=
"search"
/>
</sql>
<select
id=
"queryList"
resultType=
"com.ruoyi.system.domain.vo.FncSubjectTypeVo"
>
<include
refid=
"querySql"
/>
<if
test=
"entity.subjectTypeName != null and entity.subjectTypeName != ''"
>
and A.subject_type_name like concat('%', #{entity.subjectTypeName}, '%')
</if>
order by A.create_time desc
</select>
<select
id=
"queryById"
resultType=
"com.ruoyi.system.domain.vo.FncSubjectTypeVo"
>
<include
refid=
"querySql"
/>
and A.id = #{id}
</select>
<sql
id=
"allField"
>
A.subject_type_id,
A.parent_id,
A.subject_type_name,
A.order_num,
A.create_by,
A.create_time,
A.update_by,
A.update_time
</sql>
<sql
id=
"search"
>
where A.delete_status = 1
</sql>
</mapper>
ruoyi-ui/src/api/finance/subjectType.js
0 → 100644
View file @
8d8172b8
import
request
from
'
@/utils/request
'
// 查询科目类别列表
export
function
listSubjectType
(
query
)
{
return
request
({
url
:
'
/finance/subjectType/list
'
,
method
:
'
get
'
,
params
:
query
})
}
// 查询科目类别详细
export
function
getSubjectType
(
subjectTypeId
)
{
return
request
({
url
:
'
/finance/subjectType/
'
+
subjectTypeId
,
method
:
'
get
'
})
}
// 新增科目类别
export
function
addSubjectType
(
data
)
{
return
request
({
url
:
'
/finance/subjectType/add
'
,
method
:
'
post
'
,
data
:
data
})
}
// 修改科目类别
export
function
updateSubjectType
(
data
)
{
return
request
({
url
:
'
/finance/subjectType/update
'
,
method
:
'
put
'
,
data
:
data
})
}
// 删除科目类别
export
function
delSubjectType
(
subjectTypeId
)
{
return
request
({
url
:
'
/finance/subjectType/
'
+
subjectTypeId
,
method
:
'
delete
'
})
}
ruoyi-ui/src/views/finance/ledger/index.vue
View file @
8d8172b8
...
...
@@ -35,8 +35,8 @@
<el-input
v-model=
"queryParams.saleEvaluation"
placeholder=
"请输入销售额评估"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"创建人"
prop=
"create
b
y"
>
<el-input
v-model=
"queryParams.create
b
y"
placeholder=
"请输入创建人"
clearable
<el-form-item
label=
"创建人"
prop=
"create
B
y"
>
<el-input
v-model=
"queryParams.create
B
y"
placeholder=
"请输入创建人"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
...
...
@@ -110,7 +110,7 @@
<
el
-
table
-
column
label
=
"
客户单位
"
align
=
"
center
"
prop
=
"
customerCompany
"
/>
<
el
-
table
-
column
label
=
"
业务性质
"
align
=
"
center
"
prop
=
"
businessType
"
/>
<
el
-
table
-
column
label
=
"
销售额评估
"
align
=
"
center
"
prop
=
"
saleEvaluation
"
/>
<
el
-
table
-
column
label
=
"
创建人
"
align
=
"
center
"
prop
=
"
create
b
y
"
/>
<
el
-
table
-
column
label
=
"
创建人
"
align
=
"
center
"
prop
=
"
create
B
y
"
/>
<
el
-
table
-
column
label
=
"
操作
"
align
=
"
center
"
class
-
name
=
"
small-padding fixed-width
"
>
<
template
slot
-
scope
=
"
scope
"
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-edit
"
@
click
=
"
handleUpdate(scope.row)
"
...
...
ruoyi-ui/src/views/finance/subjecttype/index.vue
0 → 100644
View file @
8d8172b8
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"科目类别名称"
prop=
"subjectTypeName"
>
<el-input
v-model=
"queryParams.subjectTypeName"
placeholder=
"请输入科目类别名称"
clearable
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['finance:subjectType:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['finance:subjectType:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['finance:subjectType:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['finance:subjectType:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"subjectTypeList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"科目类别id"
align=
"center"
prop=
"subjectTypeId"
/>
<el-table-column
label=
"上级id"
align=
"center"
prop=
"parentId"
/>
<el-table-column
label=
"科目类别名称"
align=
"center"
prop=
"subjectTypeName"
/>
<el-table-column
label=
"显示顺序"
align=
"center"
prop=
"orderNum"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['finance:subjectType:edit']"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['finance:subjectType:remove']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 添加或修改科目类别对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"上级id"
prop=
"parentId"
>
<el-input
v-model=
"form.parentId"
placeholder=
"请输入上级id"
/>
</el-form-item>
<el-form-item
label=
"科目类别名称"
prop=
"subjectTypeName"
>
<el-input
v-model=
"form.subjectTypeName"
placeholder=
"请输入科目类别名称"
/>
</el-form-item>
<el-form-item
label=
"显示顺序"
prop=
"orderNum"
>
<el-input
v-model=
"form.orderNum"
placeholder=
"请输入显示顺序"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
listSubjectType
,
getSubjectType
,
delSubjectType
,
addSubjectType
,
updateSubjectType
}
from
"
@/api/finance/subjectType
"
;
export
default
{
name
:
"
SubjectType
"
,
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 科目类别表格数据
subjectTypeList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
subjectTypeName
:
null
,
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
parentId
:
[
{
required
:
true
,
message
:
"
上级id不能为空
"
,
trigger
:
"
blur
"
}
],
}
};
},
created
()
{
this
.
getList
();
},
methods
:
{
/** 查询科目类别列表 */
getList
()
{
this
.
loading
=
true
;
listSubjectType
(
this
.
queryParams
).
then
(
response
=>
{
this
.
subjectTypeList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
this
.
form
=
{
subjectTypeId
:
null
,
parentId
:
null
,
subjectTypeName
:
null
,
orderNum
:
null
,
createBy
:
null
,
createTime
:
null
,
updateBy
:
null
,
updateTime
:
null
};
this
.
resetForm
(
"
form
"
);
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
subjectTypeId
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
添加科目类别
"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
const
subjectTypeId
=
row
.
subjectTypeId
||
this
.
ids
getSubjectType
(
subjectTypeId
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改科目类别
"
;
});
},
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
subjectTypeId
!=
null
)
{
updateSubjectType
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"
修改成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addSubjectType
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"
新增成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
subjectTypeIds
=
row
.
subjectTypeId
||
this
.
ids
;
this
.
$modal
.
confirm
(
'
是否确认删除科目类别编号为"
'
+
subjectTypeIds
+
'
"的数据项?
'
).
then
(
function
()
{
return
delSubjectType
(
subjectTypeIds
);
}).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"
删除成功
"
);
}).
catch
(()
=>
{});
},
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'
finance/subjectType/export
'
,
{
...
this
.
queryParams
},
`subjectType_
${
new
Date
().
getTime
()}
.xlsx`
)
}
}
};
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment