Commit b4e5f57c by Mr. Lan

添加流程申请。

parent 24615c2f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
v-permisaction="['process:admin:classify:add']" v-permisaction="['process:admin:manager:add']"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
...@@ -59,14 +59,14 @@ ...@@ -59,14 +59,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-permisaction="['process:admin:classify:edit']" v-permisaction="['process:admin:manager:edit']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
v-permisaction="['process:admin:classify:delete']" v-permisaction="['process:admin:manager:delete']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
...@@ -158,7 +158,7 @@ import { ...@@ -158,7 +158,7 @@ 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 { taskList } from '@/api/process/admin/task'
import { listUser } from '@/api/system/sysuser' import { listUser } from '@/api/system/sysuser'
export default { export default {
...@@ -225,6 +225,15 @@ export default { ...@@ -225,6 +225,15 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
// 获取任务列表
getTaskList() {
taskList({
page: 1,
per_page: 99999
}).then(response => {
this.taskListData = response.data.data
})
},
// 获取流程分类列表 // 获取流程分类列表
getClassifyList() { getClassifyList() {
classifyList({ classifyList({
...@@ -249,7 +258,6 @@ export default { ...@@ -249,7 +258,6 @@ export default {
pageSize: 999999 pageSize: 999999
}).then(response => { }).then(response => {
this.users = response.data.list this.users = response.data.list
console.log(this.users)
}) })
}, },
// 获取部门 // 获取部门
...@@ -278,6 +286,7 @@ export default { ...@@ -278,6 +286,7 @@ export default {
this.getClassifyList() this.getClassifyList()
this.getTemplates() this.getTemplates()
this.getUsers() this.getUsers()
this.getTaskList()
}, },
handleCreate() { handleCreate() {
this.getProcessInitData() this.getProcessInitData()
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
v-permisaction="['process:admin:classify:add']" v-permisaction="['process:admin:task:add']"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
...@@ -58,14 +58,14 @@ ...@@ -58,14 +58,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-permisaction="['process:admin:classify:edit']" v-permisaction="['process:admin:task:edit']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
v-permisaction="['process:admin:classify:delete']" v-permisaction="['process:admin:task:delete']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
...@@ -123,11 +123,12 @@ ...@@ -123,11 +123,12 @@
<script> <script>
import { import {
createClassify, createTask,
classifyList, taskList,
updateClassify, taskDetails,
deleteClassify updateTask,
} from '@/api/process/admin/classify' deleteTask
} from '@/api/process/admin/task'
// 代码编辑器 // 代码编辑器
import { codemirror } from 'vue-codemirror' import { codemirror } from 'vue-codemirror'
...@@ -223,81 +224,85 @@ export default { ...@@ -223,81 +224,85 @@ export default {
this.loading = true this.loading = true
this.listQuery.page = this.queryParams.pageIndex this.listQuery.page = this.queryParams.pageIndex
this.listQuery.per_page = this.queryParams.pageSize this.listQuery.per_page = this.queryParams.pageSize
classifyList(this.listQuery).then(response => { taskList(this.listQuery).then(response => {
this.classifyList = response.data.data this.taskList = response.data.data
this.queryParams.pageIndex = response.data.page this.queryParams.pageIndex = response.data.page
this.queryParams.pageSize = response.data.per_page this.queryParams.pageSize = response.data.per_page
this.total = response.data.total_count this.total = response.data.total_count
this.loading = false this.loading = false
}) })
}, },
handleQuery(val) {
this.listQuery.name = val.name
this.getList()
},
handleCreate() { handleCreate() {
this.ruleForm = { this.ruleForm = {
id: undefined, name: '',
name: '' classify: '',
content: ''
} }
this.dialogFormVisibleName = 1 this.dialogFormVisibleName = 1
this.open = true this.open = true
}, },
handleEdit(row) { handleEdit(row) {
this.ruleForm.id = row.id taskDetails({
this.ruleForm.name = row.name file_name: row.full_name
this.open = true }).then(response => {
this.ruleForm = {
name: row.name,
full_name: row.full_name,
classify: row.classify,
content: response.data
}
this.dialogFormVisibleName = 2 this.dialogFormVisibleName = 2
this.open = true
})
}, },
submitForm(formName) { submitForm(formName) {
this.ruleForm.content = this.$refs.codemirror.content
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
createClassify(this.ruleForm).then(response => { createTask(this.ruleForm).then(() => {
if (response !== undefined) {
this.getList() this.getList()
this.open = false
this.$message({ this.$message({
type: 'success', message: '任务脚本创建成功',
message: '分类已增加!' type: 'success'
}) })
this.open = false
}
}) })
} }
}) })
}, },
editForm(formName) { editForm(formName) {
this.ruleForm.content = this.$refs.codemirror.content
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
updateClassify(this.ruleForm).then(response => { updateTask(this.ruleForm).then(response => {
if (response !== undefined) {
this.getList() this.getList()
this.open = false
this.$message({ this.$message({
type: 'success', message: '任务脚本更新成功',
message: '分类已更新!' type: 'success'
}) })
this.open = false
}
}) })
} }
}) })
}, },
handleQuery() {
this.queryParams.pageIndex = 1
this.queryParams.pageSize = 10
this.getList()
},
handleDelete(row) { handleDelete(row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteClassify({ deleteTask({
classifyId: row.id full_name: row.full_name
}).then(response => { }).then(() => {
if (response !== undefined) {
this.getList() this.getList()
this.$message({ this.$message({
type: 'success', type: 'success',
message: '分类已删除!' message: '删除成功!'
}) })
}
}) })
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
v-permisaction="['process:admin:classify:add']" v-permisaction="['process:admin:template:add']"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
...@@ -59,14 +59,14 @@ ...@@ -59,14 +59,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-permisaction="['process:admin:classify:edit']" v-permisaction="['process:admin:template:edit']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
v-permisaction="['process:admin:classify:delete']" v-permisaction="['process:admin:template:delete']"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
......
<template> <template>
<div> <div class="app-container">
this is apply process. <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>
<div v-for="item in processLists" :key="item.id">
<div v-if="item.process_list.length!==0">
<div class="workflow-classify-title">{{ item.name }}</div>
<div style="margin-bottom: 15px;">
<el-button
v-for="buttonItem in item.process_list"
:key="buttonItem.id"
class="workflow-classify-button"
type="primary"
plain
@click="submitWorkOrder(buttonItem.id)"
>
{{ buttonItem.name }}
</el-button>
</div>
</div>
</div>
</el-card>
</div> </div>
</template> </template>
<script> <script>
import { classifyProcessList } from '@/api/process/admin/process'
export default { export default {
name: 'ApplyProcessList',
data() { data() {
return { return {
processLists: [],
listQuery: {}
} }
}, },
created() {
this.getProcessList()
},
methods: { methods: {
getProcessList() {
classifyProcessList(this.listQuery).then(response => {
this.processLists = response.data
})
},
handleQuery() {
console.log(this.listQuery)
this.getProcessList()
},
submitWorkOrder(processId) {
this.$router.push({ path: '/process/create-ticket', query: { processId: processId }})
}
} }
} }
</script> </script>
<style scoped> <style scoped>
.workflow-classify-title {
border-bottom: 1px solid #dddddd;
padding-bottom: 5px;
}
.workflow-classify-button {
margin-left: 0;
margin-right: 12px;
margin-top: 12px;
}
</style> </style>
<template>
<div class="app-container">
<el-card class="box-card">
<div class="text item">
<el-steps :active="active" finish-status="success">
<template v-for="(item, index) in processStructure.nodes">
<el-step
v-if="item.isHideNode === false ||
item.isHideNode === undefined ||
item.isHideNode == null"
:key="index"
:title="item.label"
/>
</template>
</el-steps>
</div>
</el-card>
<el-card class="box-card" style="margin-top: 15px">
<div slot="header" class="clearfix">
<span>公共信息</span>
</div>
<div class="text item">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px">
<el-form-item label="标题" prop="title" style="margin-bottom: 0">
<el-input v-model="ruleForm.title" size="small" />
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="box-card" style="margin-top: 15px">
<div slot="header" class="clearfix">
<span>表单信息</span>
</div>
<div class="text item">
<k-form-build
v-for="(tplItem, tplIndex) in processStructure.tpls"
:key="tplIndex"
:ref="'kfd-' + tplItem.id"
:value="JSON.parse(tplItem.form_structure)"
/>
</div>
<hr style="background-color: #d9d9d9; border:0; height:1px;">
<div class="text item" style="text-align: center;margin-top:18px">
<el-button
v-for="(item, index) in processStructure.edges"
v-show="item.source===processStructure.nodes[active].id"
:key="index"
type="primary"
@click="submitAction(item.target)"
>
{{ item.label }}
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
processStructure,
createWorkOrder
} from '@/api/process/work-order'
export default {
name: 'Create',
data() {
return {
active: 0,
processStructure: {},
ruleForm: {
title: '',
process: '',
classify: '',
state: [],
source: '',
source_state: '',
process_method: '',
tpls: {
'form_structure': [],
'form_data': []
},
tasks: []
},
rules: {
title: [
{ required: true, message: '请输入工单标题', trigger: 'blur' }
]
}
}
},
created() {
this.getProcessNodeList()
},
methods: {
getProcessNodeList() {
processStructure({
processId: this.$route.query.processId
}).then(response => {
this.processStructure = response.data
})
},
submitAction(target) {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
var stateMap = {}
this.ruleForm.process = parseInt(this.$route.query.processId)
this.ruleForm.classify = this.processStructure.process.classify
stateMap['id'] = target
this.ruleForm.source_state = this.processStructure.nodes[this.active].label
for (var v of this.processStructure.nodes) {
if (v.id === target) {
if (v.assignType !== undefined) {
stateMap['process_method'] = v.assignType
}
if (v.assignValue !== undefined) {
stateMap['processor'] = Array.from(new Set(v.assignValue))
}
stateMap['label'] = v.label
break
}
}
this.ruleForm.state = [stateMap]
this.ruleForm.tpls = {
'form_structure': [],
'form_data': []
}
// 绑定流程任务
this.ruleForm.tasks = this.processStructure.process.tasks === undefined ? [] : this.processStructure.process.tasks
// 追加节点任务
if (this.processStructure.nodes[this.active].task !== undefined && this.processStructure.nodes[this.active].task.length > 0) {
for (var task of this.processStructure.nodes[this.active].task) {
if (this.ruleForm.tasks.indexOf(task) === -1) {
this.ruleForm.tasks.push(task)
}
}
}
var promiseList = []
for (var tpl of this.processStructure.tpls) {
this.ruleForm.tpls.form_structure.push(tpl.form_structure)
promiseList.push(this.$refs['kfd-' + tpl.id][0].getData())
}
Promise.all(promiseList).then(values => {
this.ruleForm.source = this.processStructure.nodes[this.active].id
this.ruleForm.tpls.form_data = values
createWorkOrder(this.ruleForm).then(response => {
if (response.code === 100000) {
this.$router.push({ name: 'my-order' })
}
})
})
}
})
}
}
}
</script>
<template>
<div>
this is handle ticket.
</div>
</template>
<script>
export default {
components: {
},
data() {
return {
}
},
methods: {
}
}
</script>
<style scoped>
</style>
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