Skip to content

Commit

Permalink
工作流
Browse files Browse the repository at this point in the history
  • Loading branch information
forezp committed Aug 16, 2019
1 parent c3cc52a commit 4f12a29
Show file tree
Hide file tree
Showing 13 changed files with 571 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public class MysqlGenerator {
// throw new MybatisPlusException("请输入正确的" + tip + "!");
// }

public static String[] tableNames={"sys_dict","sys_dict_type"};
public static String[] tableNames={"act_model_category"};

public static String packageName="io.github.forezp.modules.system";
public static String packageName="io.github.forezp.modules.activiti";
/**
* RUN THIS
*/
Expand All @@ -70,11 +70,11 @@ public static void main(String[] args) {

// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/aries?useUnicode=true&characterEncoding=utf8&tinyInt1isBit=false&useSSL=false&serverTimezone=GMT");
dsc.setUrl("jdbc:mysql://119.23.221.204:3306/aries?useUnicode=true&characterEncoding=utf8&tinyInt1isBit=false&useSSL=false&serverTimezone=GMT");
// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("123456");
dsc.setPassword("Fzp!23@2009");

mpg.setDataSource(dsc);

Expand Down
25 changes: 25 additions & 0 deletions matrix-web-admin/src/api/workflow/category.js
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 matrix-web-admin/src/views/workflow/category/category.js
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
}
}
}
}
106 changes: 106 additions & 0 deletions matrix-web-admin/src/views/workflow/category/index.vue
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>

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@MapperScan({"io.github.forezp.modules.system.mapper","io.github.forezp.modules.task.mapper"})
@MapperScan({"io.github.forezp.modules.system.mapper"
,"io.github.forezp.modules.task.mapper","io.github.forezp.modules.activiti.mapper"})
public class AriesApplication extends SpringBootServletInitializer {


Expand Down
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);
}
}
Loading

0 comments on commit 4f12a29

Please sign in to comment.