Commit 24615c2f by YuleiLan

添加任务管理。

parent 02a14710
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
"tui-editor": "1.3.3", "tui-editor": "1.3.3",
"viewerjs": "^1.6.1", "viewerjs": "^1.6.1",
"vue": "2.6.10", "vue": "2.6.10",
"vue-codemirror": "^4.0.6",
"vue-codemirror-lite": "^1.0.4", "vue-codemirror-lite": "^1.0.4",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",
"vue-cropper": "^0.5.0", "vue-cropper": "^0.5.0",
......
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
:filter-method="(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0" :filter-method="(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0"
@change="(e) => onChange('assignValue', e)" @change="(e) => onChange('assignValue', e)"
> >
<el-option v-for="user in users" :key="user.id" :label="user.nickname===''?user.username:user.nickname" :value="user.id" /> <el-option v-for="user in users" :key="user.userId" :label="user.nickName===''?user.username:user.nickName" :value="user.userId" />
</el-select> </el-select>
</div> </div>
<div v-else-if="model.assignType === 'persongroup'" class="panelRow"> <!-- <div v-else-if="model.assignType === 'persongroup'" class="panelRow">
<div>{{ i18n['handleNode.assignType.persongroup.title'] }}</div> <div>{{ i18n['handleNode.assignType.persongroup.title'] }}</div>
<el-select <el-select
style="width:90%; font-size:12px" style="width:90%; font-size:12px"
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
> >
<el-option v-for="group in groups" :key="group.id" :label="group.nickname===''?group.name:group.nickname" :value="group.id" /> <el-option v-for="group in groups" :key="group.id" :label="group.nickname===''?group.name:group.nickname" :value="group.id" />
</el-select> </el-select>
</div> </div> -->
<div v-else-if="model.assignType === 'department'" class="panelRow"> <div v-else-if="model.assignType === 'department'" class="panelRow">
<div>{{ i18n['handleNode.assignType.department.title'] }}</div> <div>{{ i18n['handleNode.assignType.department.title'] }}</div>
<el-select <el-select
......
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
:filter-method="(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0" :filter-method="(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0"
@change="(e) => onChange('assignValue', e)" @change="(e) => onChange('assignValue', e)"
> >
<el-option v-for="user in users" :key="user.id" :label="user.nickname===''?user.username:user.nickname" :value="user.id" /> <el-option v-for="user in users" :key="user.userId" :label="user.nickName===''?user.username:user.nickName" :value="user.userId" />
</el-select> </el-select>
</div> </div>
<div v-else-if="model.assignType === 'persongroup'" class="panelRow"> <!-- <div v-else-if="model.assignType === 'persongroup'" class="panelRow">
<div>{{ i18n['userTask.assignType.persongroup.title'] }}</div> <div>{{ i18n['userTask.assignType.persongroup.title'] }}</div>
<el-select <el-select
style="width:90%; font-size:12px" style="width:90%; font-size:12px"
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
> >
<el-option v-for="group in groups" :key="group.id" :label="group.nickname===''?group.name:group.nickname" :value="group.id" /> <el-option v-for="group in groups" :key="group.id" :label="group.nickname===''?group.name:group.nickname" :value="group.id" />
</el-select> </el-select>
</div> </div> -->
<div v-else-if="model.assignType === 'department'" class="panelRow"> <div v-else-if="model.assignType === 'department'" class="panelRow">
<div>{{ i18n['userTask.assignType.department.title'] }}</div> <div>{{ i18n['userTask.assignType.department.title'] }}</div>
<el-select <el-select
......
...@@ -25,6 +25,11 @@ import * as filters from './filters' // global filters ...@@ -25,6 +25,11 @@ import * as filters from './filters' // global filters
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
// 代码编辑器
import VueCodeMirror from 'vue-codemirror'
import 'codemirror/lib/codemirror.css'
Vue.use(VueCodeMirror)
// 全局方法挂载 // 全局方法挂载
Vue.prototype.parseTime = parseTime Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm Vue.prototype.resetForm = resetForm
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<el-table v-loading="loading" border :data="classifyList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="classifyList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="120" /> <el-table-column label="ID" prop="id" width="120" />
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="创建时间" align="center" prop="create_time" width="180"> <el-table-column label="创建时间" align="center" prop="create_time" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -113,7 +113,7 @@ import { ...@@ -113,7 +113,7 @@ import {
} from '@/api/process/admin/classify' } from '@/api/process/admin/classify'
export default { export default {
name: 'Role', name: 'Classify',
data() { data() {
return { return {
dialogFormVisibleName: 1, dialogFormVisibleName: 1,
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<el-table v-loading="loading" border :data="processValueList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="processValueList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="120" /> <el-table-column label="ID" prop="id" width="120" />
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="创建时间" align="center" prop="create_time" width="180" /> <el-table-column label="创建时间" align="center" prop="create_time" width="180" />
<el-table-column label="更新时间" align="center" prop="update_time" width="180" /> <el-table-column label="更新时间" align="center" prop="update_time" width="180" />
...@@ -127,7 +127,6 @@ ...@@ -127,7 +127,6 @@
v-if="wfdDesignRefresh" v-if="wfdDesignRefresh"
ref="wfd" ref="wfd"
:users="users" :users="users"
:groups="groups"
:departments="departments" :departments="departments"
:tasks="taskListData" :tasks="taskListData"
:data="ruleForm.structure" :data="ruleForm.structure"
...@@ -160,8 +159,10 @@ import { ...@@ -160,8 +159,10 @@ import {
import { classifyList } from '@/api/process/admin/classify' import { classifyList } from '@/api/process/admin/classify'
import { templateList } from '@/api/process/admin/template' import { templateList } from '@/api/process/admin/template'
import { listUser } from '@/api/system/sysuser'
export default { export default {
name: 'Role', name: 'Process',
components: { components: {
'WfdDesign': () => import('@/components/wfd/components/Wfd') 'WfdDesign': () => import('@/components/wfd/components/Wfd')
}, },
...@@ -242,6 +243,24 @@ export default { ...@@ -242,6 +243,24 @@ export default {
this.templates = response.data.data this.templates = response.data.data
}) })
}, },
// 获取用户
getUsers() {
listUser({
pageSize: 999999
}).then(response => {
this.users = response.data.list
console.log(this.users)
})
},
// 获取部门
// getDepartments() {
// departmentList({
// page: 1,
// per_page: 99999
// }).then(response => {
// this.departments = response.data.data
// })
// },
/** 查询流程列表 */ /** 查询流程列表 */
getList() { getList() {
this.loading = true this.loading = true
...@@ -255,9 +274,13 @@ export default { ...@@ -255,9 +274,13 @@ export default {
this.loading = false this.loading = false
}) })
}, },
handleCreate() { getProcessInitData() {
this.getClassifyList() this.getClassifyList()
this.getTemplates() this.getTemplates()
this.getUsers()
},
handleCreate() {
this.getProcessInitData()
this.ruleForm = { this.ruleForm = {
id: undefined, id: undefined,
name: '', name: '',
...@@ -274,8 +297,7 @@ export default { ...@@ -274,8 +297,7 @@ export default {
}) })
}, },
handleEdit(row) { handleEdit(row) {
this.getClassifyList() this.getProcessInitData()
this.getTemplates()
this.wfdDesignRefresh = false this.wfdDesignRefresh = false
processDetails({ processDetails({
processId: row.id processId: row.id
......
<template> <template>
<div> <div class="app-container">
this is task manager. <el-card class="box-card">
<el-form ref="listQuery" :model="listQuery" :inline="true">
<el-form-item label="分类名称">
<el-input
v-model="listQuery.name"
placeholder="请输入分类名称"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-permisaction="['process:admin:classify:add']"
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleCreate"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
v-permisaction="['system:sysrole:edit']"
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>编辑</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-permisaction="['system:sysrole:remove']"
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col> -->
</el-row>
<el-table v-loading="loading" border :data="taskList" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" />
<el-table-column label="UUID" prop="uuid" />
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="任务类型" prop="classify" :show-overflow-tooltip="true" />
<el-table-column label="创建者" prop="creator" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-permisaction="['process:admin:classify:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>编辑</el-button>
<el-button
v-permisaction="['process:admin:classify:delete']"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog
:title="dialogFormVisibleName===1?'新建任务':'编辑任务'"
:close-on-click-modal="false"
:visible.sync="open"
>
<div class="tpl-create-content">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px">
<el-form-item label="名称" prop="name">
<el-input v-model="ruleForm.name" placeholder="请输入任务名称" style="width: 50%" />
</el-form-item>
<el-form-item label="类型" prop="classify">
<el-select v-model="ruleForm.classify" placeholder="请选择任务类型" style="width: 50%" @change="selectTaskType">
<el-option label="Python" value="python" />
<el-option label="Shell" value="shell" />
</el-select>
</el-form-item>
<el-form-item label="任务" prop="content">
<div class="codemirror-div">
<codemirror
v-if="codemirrorRefresh"
ref="codemirror"
:value="ruleForm.content"
:options="contentOptions"
class="codemirror"
/>
</div>
</el-form-item>
</el-form>
<div style="text-align: center">
<el-button type="primary" @click="dialogFormVisibleName===1?submitForm('ruleForm'):editForm('ruleForm')">提交</el-button>
<el-button @click="open = false">取 消</el-button>
</div>
</div>
</el-dialog>
</el-card>
</div> </div>
</template> </template>
<script> <script>
import {
createClassify,
classifyList,
updateClassify,
deleteClassify
} from '@/api/process/admin/classify'
// 代码编辑器
import { codemirror } from 'vue-codemirror'
require('codemirror/mode/python/python') // 这里引入的模式的js,根据设置的mode引入,一定要引入!!
require('codemirror/mode/shell/shell') // 这里引入的模式的js,根据设置的mode引入,一定要引入!!
export default { export default {
name: 'Task',
components: {
codemirror
},
data() { data() {
return { return {
dialogFormVisibleName: 1,
queryParams: {},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 是否显示弹出层
open: false,
// 查询参数
codemirrorRefresh: true,
taskList: [],
ruleForm: {
name: '',
classify: '',
content: ''
},
contentOptions: {
flattenSpans: false, // 默认情况下,CodeMirror会将使用相同class的两个span合并成一个。通过设置此项为false禁用此功能
matchBrackets: true, // 匹配符号
lineWiseCopyCut: true, // 如果在复制或剪切时没有选择文本,那么就会自动操作光标所在的整行
tabSize: 4,
value: '',
mode: 'python',
lineNumbers: true, // 显示行号
line: true,
smartIndent: true, // 智能缩进
autoCloseBrackets: true, // 自动输入括弧
foldGutter: true, // 允许在行号位置折叠
indentUnit: 4, // 智能缩进单位为4个空格长度
styleActiveLine: true // 激活当前行样式
},
rules: {
name: [
{ required: true, message: '请输入任务名称', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value.match(/^[_a-zA-Z0-9]+$/)) {
callback()
} else {
callback(new Error('只能输入大小写英文及下划线'))
}
},
trigger: 'blur'
} }
],
classify: [
{ required: true, message: '请选择任务类型', trigger: 'change' }
],
content: [
{ required: true, message: '请输入任务内容', trigger: 'blur' }
]
},
listQuery: {
page: 1,
per_page: 10
}
}
},
created() {
this.getList()
}, },
methods: { methods: {
selectTaskType() {
if (this.ruleForm.classify === '') {
this.contentOptions.mode = 'python'
} else {
this.contentOptions.mode = this.ruleForm.classify
}
this.codemirrorRefresh = false
this.codemirrorRefresh = true
},
/** 查询角色列表 */
getList() {
this.loading = true
this.listQuery.page = this.queryParams.pageIndex
this.listQuery.per_page = this.queryParams.pageSize
classifyList(this.listQuery).then(response => {
this.classifyList = response.data.data
this.queryParams.pageIndex = response.data.page
this.queryParams.pageSize = response.data.per_page
this.total = response.data.total_count
this.loading = false
})
},
handleCreate() {
this.ruleForm = {
id: undefined,
name: ''
}
this.dialogFormVisibleName = 1
this.open = true
},
handleEdit(row) {
this.ruleForm.id = row.id
this.ruleForm.name = row.name
this.open = true
this.dialogFormVisibleName = 2
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
createClassify(this.ruleForm).then(response => {
if (response !== undefined) {
this.getList()
this.$message({
type: 'success',
message: '分类已增加!'
})
this.open = false
}
})
}
})
},
editForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
updateClassify(this.ruleForm).then(response => {
if (response !== undefined) {
this.getList()
this.$message({
type: 'success',
message: '分类已更新!'
})
this.open = false
}
})
}
})
},
handleQuery() {
this.queryParams.pageIndex = 1
this.queryParams.pageSize = 10
this.getList()
},
handleDelete(row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteClassify({
classifyId: row.id
}).then(response => {
if (response !== undefined) {
this.getList()
this.$message({
type: 'success',
message: '分类已删除!'
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSelectionChange() {}
} }
} }
</script> </script>
<style scoped> <style scoped>
.codemirror {
line-height: 150%;
}
.codemirror-div {
border: 1px solid #DCDFE6;
border-radius: 4px;
overflow: hidden;
}
</style> </style>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<el-table v-loading="loading" border :data="tplList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="tplList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="120" /> <el-table-column label="ID" prop="id" width="120" />
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="创建时间" align="center" prop="create_time" width="180" /> <el-table-column label="创建时间" align="center" prop="create_time" width="180" />
<el-table-column label="更新时间" align="center" prop="update_time" width="180" /> <el-table-column label="更新时间" align="center" prop="update_time" width="180" />
...@@ -145,7 +145,7 @@ Vue.use(GenerateForm) ...@@ -145,7 +145,7 @@ Vue.use(GenerateForm)
Vue.use(MakingForm) Vue.use(MakingForm)
export default { export default {
name: 'Role', name: 'Template',
data() { data() {
return { return {
dialogFormVisibleName: 1, dialogFormVisibleName: 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment