Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
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
位宇华
klck
Commits
8f56274d
Commit
8f56274d
authored
Sep 06, 2023
by
张兴海
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
六矿物料
parent
0ba73062
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1156 additions
and
0 deletions
+1156
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActClassificationController.java
.../ruoyi/system/controller/ActClassificationController.java
+166
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActClassification.java
.../main/java/com/ruoyi/system/domain/ActClassification.java
+93
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActClassificationMapper.java
...java/com/ruoyi/system/mapper/ActClassificationMapper.java
+77
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActClassificationService.java
...a/com/ruoyi/system/service/IActClassificationService.java
+86
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActClassificationServiceImpl.java
...oyi/system/service/impl/ActClassificationServiceImpl.java
+151
-0
ruoyi-supplies/src/main/resources/mapper/system/ActClassificationMapper.xml
.../main/resources/mapper/system/ActClassificationMapper.xml
+118
-0
ruoyi-ui/src/api/ActClassification/ActClassification.js
ruoyi-ui/src/api/ActClassification/ActClassification.js
+90
-0
ruoyi-ui/src/views/system/ActClassification/index.vue
ruoyi-ui/src/views/system/ActClassification/index.vue
+375
-0
No files found.
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActClassificationController.java
0 → 100644
View file @
8f56274d
package
com.ruoyi.system.controller
;
import
java.util.List
;
import
com.ruoyi.system.domain.ActClassification
;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.service.IActClassificationService
;
import
com.ruoyi.system.web.ServiceCode
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
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.common.core.page.TableDataInfo
;
/**
* 分配信息Controller
*
* @author ruoyi
* @date 2023-08-11
*/
@RestController
@RequestMapping
(
"/ActClassification/ActClassification"
)
public
class
ActClassificationController
extends
BaseController
{
@Autowired
private
IActClassificationService
actClassificationService
;
/**
* 查询上级分类
* */
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:savepid')"
)
@GetMapping
(
"/savepid"
)
@ResponseBody
public
TableDataInfo
saveSid
(){
List
<
ActClassification
>
options
=
actClassificationService
.
savePid
();
return
getDataTable
(
options
);
}
/**
* 查询分配信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
ActClassification
actClassification
)
{
startPage
();
List
<
ActClassification
>
list
=
actClassificationService
.
selectActClassificationList
(
actClassification
);
return
getDataTable
(
list
);
}
/**
* 导出分配信息列表
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:export')"
)
@Log
(
title
=
"分配信息"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
ActClassification
actClassification
)
{
List
<
ActClassification
>
list
=
actClassificationService
.
selectActClassificationList
(
actClassification
);
ExcelUtil
<
ActClassification
>
util
=
new
ExcelUtil
<
ActClassification
>(
ActClassification
.
class
);
return
util
.
exportExcel
(
list
,
"分配信息数据"
);
}
/**
* 获取分配信息详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
actClassificationService
.
selectActClassificationById
(
id
));
}
/**
* 新增分配信息
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:add')"
)
@Log
(
title
=
"分配信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
ActClassification
actClassification
)
{
return
toAjax
(
actClassificationService
.
insertActClassification
(
actClassification
));
}
/**
* 修改分配信息
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:edit')"
)
@Log
(
title
=
"分配信息"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
ActClassification
actClassification
)
{
return
toAjax
(
actClassificationService
.
updateActClassification
(
actClassification
));
}
/**
* 删除分配信息
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:remove')"
)
@Log
(
title
=
"分配信息"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
actClassificationService
.
deleteActClassificationByIds
(
ids
));
}
/**
* 启用物料细分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:enable')"
)
@PutMapping
(
"/{id}/enable"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
actClassificationService
.
setEnable
(
id
,
status
);
if
(
status
<
0
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"启用失败"
);
}
else
{
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"启用成功"
);
}
}
/**
* 禁用物料细分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('ActClassification:ActClassification:Disable')"
)
@PutMapping
(
"/{id}/disable"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
if
(
actClassificationService
.
findId
(
id
).
size
()>
0
){
return
AjaxResult
.
success
(
"该物料下存在关联物料,请先删除关联物料!!!"
,
"操作失败"
);
}
actClassificationService
.
setDisable
(
id
,
status
);
if
(
status
>
1
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"禁用失败"
);
}
return
AjaxResult
.
success
(
"200"
,
"禁用成功"
);
}
@PreAuthorize
(
"@ss.hasPermission('ActClassification:ActClassification:GetAll')"
)
@GetMapping
(
"/all"
)
public
List
<
ActClassification
>
getAllActClassifications
()
{
return
actClassificationService
.
getAllActClassifications
();
}
@PreAuthorize
(
"@ss.hasPermission('ActClassification:ActClassification:GetSub')"
)
@GetMapping
(
"/sub/{parentId}"
)
public
List
<
ActClassification
>
getSubActClassifications
(
@PathVariable
(
"parentId"
)
int
parentId
)
{
return
actClassificationService
.
getSubActClassifications
(
parentId
);
}
}
ruoyi-supplies/src/main/java/com/ruoyi/system/domain/ActClassification.java
0 → 100644
View file @
8f56274d
package
com.ruoyi.system.domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 分配信息对象 ActClassification
*
* @author ruoyi
* @date 2023-08-11
*/
public
class
ActClassification
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** ID */
private
Long
id
;
/** 名称 */
@Excel
(
name
=
"名称"
)
private
String
name
;
private
String
fname
;
/** 父ID */
@Excel
(
name
=
"父ID"
)
private
Long
pid
;
public
String
getFname
()
{
return
fname
;
}
public
void
setFname
(
String
fname
)
{
this
.
fname
=
fname
;
}
/** 状态 */
@Excel
(
name
=
"状态"
,
readConverterExp
=
"0=启用,1=禁用"
)
private
String
status
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setPid
(
Long
pid
)
{
this
.
pid
=
pid
;
}
public
Long
getPid
()
{
return
pid
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
{
return
status
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"name"
,
getName
())
.
append
(
"pid"
,
getPid
())
.
append
(
"status"
,
getStatus
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
toString
();
}
}
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActClassificationMapper.java
0 → 100644
View file @
8f56274d
package
com.ruoyi.system.mapper
;
import
java.util.List
;
import
java.util.Map
;
import
com.ruoyi.system.domain.ActClassification
;
import
com.ruoyi.system.domain.ActSupplies
;
import
org.springframework.stereotype.Repository
;
/**
* 分配信息Mapper接口
*
* @author ruoyi
* @date 2023-08-11
*/
@Repository
public
interface
ActClassificationMapper
{
/**
* 查询分配信息
*
* @param id 分配信息ID
* @return 分配信息
*/
public
ActClassification
selectActClassificationById
(
Long
id
);
/**
* 查询分配信息列表
*
* @param actClassification 分配信息
* @return 分配信息集合
*/
public
List
<
ActClassification
>
selectActClassificationList
(
ActClassification
actClassification
);
/**
* 新增分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
public
int
insertActClassification
(
ActClassification
actClassification
);
/**
* 修改分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
public
int
updateActClassification
(
ActClassification
actClassification
);
/**
* 删除分配信息
*
* @param id 分配信息ID
* @return 结果
*/
public
int
deleteActClassificationById
(
Long
id
);
/**
* 批量删除分配信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public
int
deleteActClassificationByIds
(
Long
[]
ids
);
List
<
Integer
>
findId
(
Long
id
);
int
updateActClassification
(
Map
<
String
,
Object
>
paramMap
);
int
setEnable
(
Map
<
String
,
Object
>
paramMap
);
int
setDisable
(
Map
<
String
,
Object
>
paramMap
);
List
<
ActClassification
>
selectAll
();
List
<
ActClassification
>
selectByParentId
(
int
parentId
);
List
<
ActClassification
>
savePid
();
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActClassificationService.java
0 → 100644
View file @
8f56274d
package
com.ruoyi.system.service
;
import
java.util.List
;
import
com.ruoyi.system.domain.ActClassification
;
import
com.ruoyi.system.domain.ActSupplies
;
import
io.lettuce.core.dynamic.annotation.Param
;
/**
* 分配信息Service接口
*
* @author ruoyi
* @date 2023-08-11
*/
public
interface
IActClassificationService
{
/**
* 查询分配信息
*
* @param id 分配信息ID
* @return 分配信息
*/
public
ActClassification
selectActClassificationById
(
Long
id
);
/**
* 查询分配信息列表
*
* @param actClassification 分配信息
* @return 分配信息集合
*/
public
List
<
ActClassification
>
selectActClassificationList
(
ActClassification
actClassification
);
/**
* 新增分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
public
int
insertActClassification
(
ActClassification
actClassification
);
/**
* 修改分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
public
int
updateActClassification
(
ActClassification
actClassification
);
/**
* 批量删除分配信息
*
* @param ids 需要删除的分配信息ID
* @return 结果
*/
public
int
deleteActClassificationByIds
(
Long
[]
ids
);
/**
* 删除分配信息信息
*
* @param id 分配信息ID
* @return 结果
*/
public
int
deleteActClassificationById
(
Long
id
);
List
<
Integer
>
findId
(
Long
id
);
/**
* 启用物料细分类管理
*
* @param id 尝试启用物料细分类管理的id
* @return
*/
int
setEnable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
/**
* 禁用
*
* @param id 尝试禁用物料细分类管理的id
*/
int
setDisable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
List
<
ActClassification
>
getAllActClassifications
();
List
<
ActClassification
>
getSubActClassifications
(
int
parentId
);
List
<
ActClassification
>
savePid
();
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActClassificationServiceImpl.java
0 → 100644
View file @
8f56274d
package
com.ruoyi.system.service.impl
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.system.domain.ActClassification
;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.mapper.ActClassificationMapper
;
import
com.ruoyi.system.service.IActClassificationService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 分配信息Service业务层处理
*
* @author ruoyi
* @date 2023-08-11
*/
@Service
public
class
ActClassificationServiceImpl
implements
IActClassificationService
{
@Autowired
private
ActClassificationMapper
actClassificationMapper
;
/**
* 查询分配信息
*
* @param id 分配信息ID
* @return 分配信息
*/
@Override
public
ActClassification
selectActClassificationById
(
Long
id
)
{
return
actClassificationMapper
.
selectActClassificationById
(
id
);
}
/**
* 查询分配信息列表
*
* @param actClassification 分配信息
* @return 分配信息
*/
@Override
public
List
<
ActClassification
>
selectActClassificationList
(
ActClassification
actClassification
)
{
return
actClassificationMapper
.
selectActClassificationList
(
actClassification
);
}
/**
* 新增分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
@Override
public
int
insertActClassification
(
ActClassification
actClassification
)
{
actClassification
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
actClassificationMapper
.
insertActClassification
(
actClassification
);
}
/**
* 修改分配信息
*
* @param actClassification 分配信息
* @return 结果
*/
@Override
public
int
updateActClassification
(
ActClassification
actClassification
)
{
actClassification
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
actClassificationMapper
.
updateActClassification
(
actClassification
);
}
/**
* 批量删除分配信息
*
* @param ids 需要删除的分配信息ID
* @return 结果
*/
@Override
public
int
deleteActClassificationByIds
(
Long
[]
ids
)
{
return
actClassificationMapper
.
deleteActClassificationByIds
(
ids
);
}
/**
* 删除分配信息信息
*
* @param id 分配信息ID
* @return 结果
*/
@Override
public
int
deleteActClassificationById
(
Long
id
)
{
return
actClassificationMapper
.
deleteActClassificationById
(
id
);
}
@Override
public
List
<
Integer
>
findId
(
Long
id
)
{
return
actClassificationMapper
.
findId
(
id
);
}
@Override
public
int
setEnable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actClassificationMapper
.
setEnable
(
paramMap
);
}
@Override
public
int
setDisable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actClassificationMapper
.
setDisable
(
paramMap
);
}
private
int
updateStatusById
(
Long
id
,
Integer
status
){
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actClassificationMapper
.
updateActClassification
(
paramMap
);
}
@Override
public
List
<
ActClassification
>
savePid
()
{
return
actClassificationMapper
.
savePid
();
}
@Override
public
List
<
ActClassification
>
getAllActClassifications
()
{
return
actClassificationMapper
.
selectAll
();
}
@Override
public
List
<
ActClassification
>
getSubActClassifications
(
int
parentId
)
{
return
actClassificationMapper
.
selectByParentId
(
parentId
);
}
}
ruoyi-supplies/src/main/resources/mapper/system/ActClassificationMapper.xml
0 → 100644
View file @
8f56274d
<?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.ActClassificationMapper"
>
<resultMap
type=
"ActClassification"
id=
"ActClassificationResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"pid"
column=
"pid"
/>
<result
property=
"fname"
column=
"fname"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<sql
id=
"selectActClassificationVo"
>
select id, name, pid, status, create_by, create_time, update_by, update_time from act_classification
</sql>
<select
id=
"selectActClassificationList"
parameterType=
"ActClassification"
resultMap=
"ActClassificationResult"
>
select a.id, a.name, a.pid, a.status, a.create_by, a.update_by, b.name fname from act_classification a left join act_classification b on a.pid = b.id
<where>
<if
test=
"name != null"
>
and a.name = #{name }
</if>
<if
test=
"id != null"
>
and a.pid = #{id}
</if>
<if
test=
"status != null"
>
and a.status=#{status}
</if>
</where>
</select>
<select
id=
"selectActClassificationById"
parameterType=
"Long"
resultMap=
"ActClassificationResult"
>
<include
refid=
"selectActClassificationVo"
/>
where id = #{id}
</select>
<select
id=
"savePid"
parameterType=
"ActClassification"
resultMap=
"ActClassificationResult"
>
select id ,pid,name from act_classification where pid=0 and status = 0;
</select>
<update
id=
"setEnable"
parameterType=
"java.util.Map"
>
UPDATE ActClassification
SET status = 0
WHERE id = #{id}
</update>
<update
id=
"setDisable"
parameterType=
"java.util.Map"
>
UPDATE ActClassification
SET status = 1
WHERE id = #{id}
</update>
<select
id=
"findId"
resultType=
"Integer"
>
select pid from act_classification where pid = #{id}
</select>
<insert
id=
"insertActClassification"
parameterType=
"ActClassification"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into act_classification
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"pid != null"
>
pid,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"name != null"
>
#{name},
</if>
<if
test=
"pid != null"
>
#{pid},
</if>
<if
test=
"status != null"
>
#{status},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
</trim>
</insert>
<update
id=
"updateActClassification"
parameterType=
"ActClassification"
>
update act_classification
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"name != null"
>
name = #{name},
</if>
<if
test=
"pid != null"
>
pid = #{pid},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteActClassificationById"
parameterType=
"Long"
>
delete from act_classification where id = #{id}
</delete>
<delete
id=
"deleteActClassificationByIds"
parameterType=
"String"
>
delete from act_classification where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<sql
id=
"Base_Column_List"
>
id, name, pid, status, create_by, create_time, update_by, update_time
</sql>
<select
id=
"selectAll"
resultMap=
"ActClassificationResult"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM act_classification
</select>
<select
id=
"selectByParentId"
resultMap=
"ActClassificationResult"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM act_classification
WHERE pid = #{parentId}
</select>
</mapper>
\ No newline at end of file
ruoyi-ui/src/api/ActClassification/ActClassification.js
0 → 100644
View file @
8f56274d
import
request
from
'
@/utils/request
'
// 查询分配信息列表
export
function
listActClassification
(
query
)
{
return
request
({
url
:
'
/ActClassification/ActClassification/list
'
,
method
:
'
get
'
,
params
:
query
})
}
//查询上级ID
export
function
savePid
()
{
return
request
({
url
:
'
/ActClassification/ActClassification/savepid
'
,
method
:
'
get
'
})
}
// 查询分配信息详细
export
function
getActClassification
(
id
)
{
return
request
({
url
:
'
/ActClassification/ActClassification/
'
+
id
,
method
:
'
get
'
})
}
// 新增分配信息
export
function
addActClassification
(
data
)
{
return
request
({
url
:
'
/ActClassification/ActClassification
'
,
method
:
'
post
'
,
data
:
data
})
}
// 修改分配信息
export
function
updateActClassification
(
data
)
{
return
request
({
url
:
'
/ActClassification/ActClassification
'
,
method
:
'
put
'
,
data
:
data
})
}
// 删除分配信息
export
function
delActClassification
(
id
)
{
return
request
({
url
:
'
/ActClassification/ActClassification/
'
+
id
,
method
:
'
delete
'
})
}
// 导出分配信息
export
function
exportActClassification
(
query
)
{
return
request
({
url
:
'
/ActClassification/ActClassification/export
'
,
method
:
'
get
'
,
params
:
query
})
}
//启用
export
function
toggleEnable
(
id
)
{
return
request
({
url
:
`/ActClassification/ActClassification/
${
id
}
/enable?status=0`
,
method
:
'
put
'
,
})
}
//禁用
export
function
toggleDisable
(
id
)
{
return
request
({
url
:
`/ActClassification/ActClassification/
${
id
}
/disable?status=1`
,
method
:
'
put
'
,
})
}
export
function
getAllActClassifications
(
query
)
{
return
request
({
url
:
'
/ActClassification/ActClassification/GetAll
'
,
method
:
'
get
'
,
params
:
query
})
}
export
function
getSubActClassifications
(
parentId
)
{
return
request
({
url
:
`/ActClassification/ActClassification/GetSub`
+
parentId
,
method
:
'
get
'
,
})
}
ruoyi-ui/src/views/system/ActClassification/index.vue
0 → 100644
View file @
8f56274d
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
maxlength=
"36"
/>
</el-form-item>
<el-form-item
label=
"上级分类"
prop=
"id"
>
<el-select
v-model=
"queryParams.id"
filterable
clearable
placeholder=
"请选择上级分类"
>
<el-option
v-for=
"option in options"
:label=
"option.name"
:value=
"option.id"
></el-option>
<el-option
label=
"无"
value=
"0"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择状态"
clearable
@
keyup.enter.native=
"handleQuery"
>
<el-option
label=
"启用"
:value=
"0"
></el-option>
<el-option
label=
"禁用"
:value=
"1"
></el-option>
</el-select>
</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=
"['ActClassification:ActClassification: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=
"['ActClassification:ActClassification: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=
"['ActClassification:ActClassification: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=
"['ActClassification:ActClassification:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"ActClassificationList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"ID"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"名称"
align=
"center"
prop=
"name"
/>
<el-table-column
label=
"上级分类"
align=
"center"
>
<template
slot-scope=
"scope"
>
<div>
<template
v-if=
"scope.row.fname === null"
>
无
</
template
>
<
template
v-else
>
{{
scope
.
row
.
fname
}}
</
template
>
</div>
</template>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<div>
<el-switch
@
change=
"toggleEnable(scope.row)"
v-model=
"scope.row.status"
:active-value=
"0"
:inactive-value=
"1"
active-color=
"#13ce66"
inactive-color=
"#cccccc"
>
</el-switch>
</div>
</
template
>
</el-table-column>
<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=
"['ActClassification:ActClassification:edit']"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['ActClassification:ActClassification: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=
"名称"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入名称"
maxlength=
"36"
/>
</el-form-item>
<el-form-item
label=
"父ID"
prop=
"pid"
>
<el-select
v-model=
"form.pid"
filterable
placeholder=
"请输入所属大类"
style=
"width:380px"
>
<el-option
v-for=
"option in options"
:key=
"option.name"
:label=
"option.name"
:value=
"option.id"
></el-option>
<el-option
label=
"无"
:value=
"0"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"form.status"
placeholder=
"请选择状态"
style=
"width:380px"
>
<el-option
label=
"启用"
:value=
"0"
></el-option>
<el-option
label=
"禁用"
:value=
"1"
></el-option>
</el-select>
</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
{
listActClassification
,
savePid
,
toggleEnable
,
toggleDisable
,
getActClassification
,
delActClassification
,
addActClassification
,
updateActClassification
,
exportActClassification
}
from
"
@/api/ActClassification/ActClassification
"
;
export
default
{
name
:
"
ActClassification
"
,
components
:
{
},
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 分配信息表格数据
ActClassificationList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
options
:[],
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
name
:
null
,
pid
:
null
,
status
:
null
,
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
}
};
},
created
()
{
this
.
getList
();
},
mounted
()
{
this
.
fetchOptions
();
},
methods
:
{
/**启用 */
toggleEnable
(
ActClassification
){
console
.
log
(
'
你点击了【
'
+
ActClassification
.
name
+
'
】的开关控件,当前开关值:
'
+
ActClassification
.
status
);
let
enableText
=
[
'
启用
'
,
'
禁用
'
];
if
(
ActClassification
.
status
===
0
)
{
toggleEnable
(
ActClassification
.
id
).
then
((
response
)
=>
{
if
(
response
.
code
===
200
){
let
message
=
'
操作成功,已经将【
'
+
ActClassification
.
name
+
'
】的状态改为【
'
+
enableText
[
ActClassification
.
status
]
+
'
】 !
'
;
this
.
$message
({
message
:
message
,
type
:
'
success
'
});
}
else
{
this
.
$message
.
error
(
response
.
message
);
}
});
}
else
{
toggleDisable
(
ActClassification
.
id
).
then
((
response
)
=>
{
if
(
response
.
code
===
200
){
let
message
=
'
操作成功,已经将【
'
+
ActClassification
.
name
+
'
】的状态改为【
'
+
enableText
[
ActClassification
.
status
]
+
'
】 !
'
;
this
.
$message
({
message
:
message
,
type
:
'
error
'
});
}
else
{
this
.
getList
();
this
.
$message
.
error
(
response
.
code
);
}
});
}
},
/** 查询上级关联关系*/
fetchOptions
()
{
savePid
().
then
(
response
=>
{
console
.
log
(
response
.
rows
)
this
.
options
=
response
.
rows
;
});
},
/** 查询分配信息列表 */
getList
()
{
this
.
loading
=
true
;
listActClassification
(
this
.
queryParams
).
then
(
response
=>
{
this
.
ActClassificationList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
name
:
null
,
pid
:
null
,
status
:
"
0
"
,
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
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
添加分配信息
"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
getActClassification
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改分配信息
"
;
});
},
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
updateActClassification
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"
修改成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addActClassification
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"
新增成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
this
.
$confirm
(
'
是否确认删除分配信息编号为"
'
+
ids
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
}).
then
(
function
()
{
return
delActClassification
(
ids
);
}).
then
(()
=>
{
this
.
getList
();
this
.
msgSuccess
(
"
删除成功
"
);
})
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
;
this
.
$confirm
(
'
是否确认导出所有分配信息数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
}).
then
(
function
()
{
return
exportActClassification
(
queryParams
);
}).
then
(
response
=>
{
this
.
download
(
response
.
msg
);
})
}
}
};
</
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