-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
571 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import request from '@/utils/request' | ||
|
||
export function addCategory(params) { | ||
return request({ | ||
url: '/task-group', | ||
method: 'post', | ||
params | ||
}) | ||
} | ||
|
||
export function updateCategory(params) { | ||
return request({ | ||
url: '/task-group', | ||
method: 'put', | ||
params | ||
}) | ||
} | ||
|
||
export function categoryList(params) { | ||
return request({ | ||
url: '/task-group/pagelist', | ||
method: 'get', | ||
params | ||
}) | ||
} |
169 changes: 169 additions & 0 deletions
169
matrix-web-admin/src/views/workflow/category/category.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import { addCategory, updateCategory, categoryList } from '@/api/workflow/category' | ||
|
||
export default { | ||
data() { | ||
return { | ||
isUpdate: false, | ||
formVisible: false, | ||
groupIdInputDisabled: false, | ||
formTitle: '添加任务', | ||
isAdd: true, | ||
form: { | ||
id: '', | ||
categoryId: '', | ||
categoryName: '', | ||
pCategoryId: '' | ||
}, | ||
rules: { | ||
categoryId: [ | ||
{ required: true, message: '请输入分类ID', trigger: 'blur' }, | ||
{ min: 2, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur' } | ||
], | ||
categoryName: [ | ||
{ required: true, message: '请输入分类名', trigger: 'blur' } | ||
] | ||
|
||
}, | ||
listQuery: { | ||
categoryId: undefined, | ||
categoryName: undefined, | ||
pCategoryId: undefined, | ||
page: 1, | ||
pageSize: 100 | ||
}, | ||
totalCount: 0, | ||
list: null, | ||
listLoading: true, | ||
selRow: {} | ||
} | ||
}, | ||
filters: { | ||
statusFilter(status) { | ||
const statusMap = { | ||
published: 'success', | ||
draft: 'gray', | ||
deleted: 'danger' | ||
} | ||
return statusMap[status] | ||
} | ||
}, | ||
created() { | ||
this.init() | ||
}, | ||
methods: { | ||
init() { | ||
this.fetchData() | ||
}, | ||
fetchData() { | ||
this.listLoading = true | ||
categoryList(this.listQuery).then(response => { | ||
this.list = response.data.list | ||
this.listLoading = false | ||
this.totalCount = response.data.totalCount | ||
}) | ||
}, | ||
search() { | ||
this.fetchData() | ||
}, | ||
reset() { | ||
this.listQuery.groupName = '' | ||
this.listQuery.groupId = '' | ||
this.fetchData() | ||
}, | ||
handleFilter() { | ||
this.listQuery.page = 1 | ||
this.getList() | ||
}, | ||
handleClose() { | ||
|
||
}, | ||
handleCurrentChange(currentRow, oldCurrentRow) { | ||
this.selRow = currentRow | ||
}, | ||
resetForm() { | ||
this.form = {} | ||
}, | ||
add() { | ||
this.resetForm() | ||
this.formTitle = '添加分类' | ||
this.formVisible = true | ||
this.isAdd = true | ||
this.isUpdate = false | ||
this.groupIdInputDisabled = false | ||
}, | ||
fetchNext() { | ||
this.listQuery.page = this.listQuery.page + 1 | ||
this.fetchData() | ||
}, | ||
fetchPrev() { | ||
this.listQuery.page = this.listQuery.page - 1 | ||
this.fetchData() | ||
}, | ||
fetchPage(page) { | ||
this.listQuery.page = page | ||
this.fetchData() | ||
}, | ||
changeSize(pageSize) { | ||
this.listQuery.pageSize = pageSize | ||
this.fetchData() | ||
}, | ||
save() { | ||
var self = this | ||
this.$refs['form'].validate((valid) => { | ||
if (valid) { | ||
if (this.isUpdate) { | ||
updateCategory({ | ||
id: self.form.id, | ||
categoryName: self.form.categoryName | ||
}).then(response => { | ||
console.log(response) | ||
this.$message({ | ||
message: '提交成功', | ||
type: 'success' | ||
}) | ||
this.fetchData() | ||
this.formVisible = false | ||
}) | ||
} else { | ||
addCategory({ | ||
id: self.form.id, | ||
categoryId: self.form.categoryId, | ||
categoryName: self.form.categoryName, | ||
pCategoryId: self.form.pCategoryId | ||
}).then(response => { | ||
console.log(response) | ||
this.$message({ | ||
message: '提交成功', | ||
type: 'success' | ||
}) | ||
this.fetchData() | ||
this.formVisible = false | ||
}) | ||
} | ||
} else { | ||
return false | ||
} | ||
}) | ||
}, | ||
checkSel() { | ||
if (this.selRow && this.selRow.id) { | ||
return true | ||
} | ||
this.$message({ | ||
message: '请选中操作项', | ||
type: 'warning' | ||
}) | ||
return false | ||
}, | ||
edit() { | ||
if (this.checkSel()) { | ||
this.isAdd = false | ||
this.form = this.selRow | ||
this.formTitle = '修改分类' | ||
this.formVisible = true | ||
this.groupIdInputDisabled = true | ||
this.isUpdate = true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<template> | ||
<div class="app-container"> | ||
<div class="block"> | ||
<el-row :gutter="20"> | ||
<el-col :span="6"> | ||
<el-input v-model="listQuery.categoryId" placeholder="请输入分类ID"></el-input> | ||
</el-col> | ||
<el-col :span="6"> | ||
<el-input v-model="listQuery.categoryName" placeholder="请输入分类名称"></el-input> | ||
</el-col> | ||
<el-col :span="6"> | ||
<el-input v-model="listQuery.pCategoryId" placeholder="请输入分类父ID"></el-input> | ||
</el-col> | ||
<el-col :span="6"> | ||
<el-button type="success" icon="el-icon-search" @click.native="search">{{ $t('button.search') }}</el-button> | ||
<el-button type="primary" icon="el-icon-refresh" @click.native="reset">{{ $t('button.reset') }}</el-button> | ||
</el-col> | ||
</el-row> | ||
<br> | ||
<el-row> | ||
<el-col :span="24"> | ||
<el-button type="success" icon="el-icon-plus" @click.native="add">{{ $t('button.add') }}</el-button> | ||
<el-button type="primary" icon="el-icon-edit" @click.native="edit">{{ $t('button.edit') }}</el-button> | ||
</el-col> | ||
</el-row> | ||
</div> | ||
|
||
<el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row | ||
@current-change="handleCurrentChange"> | ||
<el-table-column label="分类ID"> | ||
<template slot-scope="scope"> | ||
{{scope.row.categoryId}} | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="分类名称" > | ||
<template slot-scope="scope"> | ||
{{scope.row.categoryName}} | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="父分类ID"> | ||
<template slot-scope="scope"> | ||
{{scope.row.pCategoryId}} | ||
</template> | ||
</el-table-column> | ||
|
||
<el-table-column label="创建时间"> | ||
<template slot-scope="scope"> | ||
{{scope.row.createTime}} | ||
</template> | ||
</el-table-column> | ||
|
||
</el-table> | ||
|
||
<el-dialog | ||
:title="formTitle" | ||
:visible.sync="formVisible" | ||
width="70%"> | ||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||
<el-row> | ||
<el-col :span="12"> | ||
<el-form-item label="任务组名" prop="name"> | ||
<el-input v-model="form.categoryId" :disabled="groupIdInputDisabled"></el-input> | ||
</el-form-item> | ||
</el-col> | ||
|
||
<el-col :span="12"> | ||
<el-form-item label="任务组ID" prop="name"> | ||
<el-input v-model="form.categoryName" ></el-input> | ||
</el-form-item> | ||
</el-col> | ||
|
||
<el-col :span="12"> | ||
<el-form-item label="任务组ID" prop="name"> | ||
<el-input v-model="form.pCategoryId" :disabled="groupIdInputDisabled"></el-input> | ||
</el-form-item> | ||
</el-col> | ||
|
||
</el-row> | ||
<el-form-item> | ||
<el-button type="primary" @click="save">{{ $t('button.submit') }}</el-button> | ||
<el-button @click.native="formVisible = false">{{ $t('button.cancel') }}</el-button> | ||
</el-form-item> | ||
|
||
</el-form> | ||
</el-dialog> | ||
<el-pagination | ||
background | ||
layout="total, sizes, prev, pager, next, jumper" | ||
:page-sizes="[10, 20, 50, 100,500]" | ||
:page-size="listQuery.pageSize" | ||
:total="totalCount" | ||
@size-change="changeSize" | ||
@current-change="fetchPage" | ||
@prev-click="fetchPrev" | ||
@next-click="fetchNext"> | ||
</el-pagination> | ||
</div> | ||
</template> | ||
|
||
<script src="./category.js"></script> | ||
|
||
|
||
<style rel="stylesheet/scss" lang="scss" scoped> | ||
@import "src/styles/common.scss"; | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...rc/main/java/io/github/forezp/modules/activiti/controller/ActModelCategoryController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package io.github.forezp.modules.activiti.controller; | ||
|
||
|
||
import io.github.forezp.common.dto.PageResultsDTO; | ||
import io.github.forezp.common.dto.RespDTO; | ||
import io.github.forezp.common.exception.AriesException; | ||
import io.github.forezp.common.exception.ErrorCode; | ||
import io.github.forezp.common.util.PageUtils; | ||
import io.github.forezp.modules.activiti.service.ActModelCategoryService; | ||
import io.github.forezp.modules.task.service.QrtzTriggersGroupService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import org.springframework.stereotype.Controller; | ||
|
||
/** | ||
* <p> | ||
* 前端控制器 | ||
* </p> | ||
* | ||
* @author forezp | ||
* @since 2019-08-16 | ||
*/ | ||
@Controller | ||
@RequestMapping("/model-category") | ||
public class ActModelCategoryController { | ||
|
||
@Autowired | ||
ActModelCategoryService actModelCategoryService; | ||
|
||
|
||
@PostMapping("") | ||
public RespDTO addCategory(@RequestParam String categoryId, @RequestParam String categoryName, @RequestParam String pCategoryId) { | ||
if (actModelCategoryService.addModelCategory(categoryId, categoryName, pCategoryId)) { | ||
return RespDTO.onSuc(null); | ||
} else { | ||
throw new AriesException(ErrorCode.INSERT_DATA_FAIL); | ||
} | ||
} | ||
|
||
@PutMapping("") | ||
public RespDTO updateCategory(@RequestParam Long id, @RequestParam String groupName) { | ||
if (actModelCategoryService.updateModelCategory(id, groupName)) { | ||
return RespDTO.onSuc(null); | ||
} else { | ||
throw new AriesException(ErrorCode.UPDATE_DATA_FAIL); | ||
} | ||
} | ||
|
||
@GetMapping("/pagelist") | ||
public RespDTO getCategoryPagelist(@RequestParam int page, @RequestParam int pageSize | ||
, @RequestParam(required = false) String categoryId | ||
, @RequestParam(required = false) String categoryName | ||
, @RequestParam(required = false) String pCategoryId) { | ||
PageUtils.check(page, pageSize); | ||
PageResultsDTO resultsDTO = actModelCategoryService.selectPagelist(page, pageSize, categoryId, categoryName, pCategoryId); | ||
return RespDTO.onSuc(resultsDTO); | ||
} | ||
} |
Oops, something went wrong.