Commit b4e5f57c by Mr. Lan

添加流程申请。

parent 24615c2f
......@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-permisaction="['process:admin:classify:add']"
v-permisaction="['process:admin:manager:add']"
type="primary"
icon="el-icon-plus"
size="mini"
......@@ -59,14 +59,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-permisaction="['process:admin:classify:edit']"
v-permisaction="['process:admin:manager:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>编辑</el-button>
<el-button
v-permisaction="['process:admin:classify:delete']"
v-permisaction="['process:admin:manager:delete']"
size="mini"
type="text"
icon="el-icon-delete"
......@@ -158,7 +158,7 @@ import {
import { classifyList } from '@/api/process/admin/classify'
import { templateList } from '@/api/process/admin/template'
import { taskList } from '@/api/process/admin/task'
import { listUser } from '@/api/system/sysuser'
export default {
......@@ -225,6 +225,15 @@ export default {
this.getList()
},
methods: {
// 获取任务列表
getTaskList() {
taskList({
page: 1,
per_page: 99999
}).then(response => {
this.taskListData = response.data.data
})
},
// 获取流程分类列表
getClassifyList() {
classifyList({
......@@ -249,7 +258,6 @@ export default {
pageSize: 999999
}).then(response => {
this.users = response.data.list
console.log(this.users)
})
},
// 获取部门
......@@ -278,6 +286,7 @@ export default {
this.getClassifyList()
this.getTemplates()
this.getUsers()
this.getTaskList()
},
handleCreate() {
this.getProcessInitData()
......
......@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-permisaction="['process:admin:classify:add']"
v-permisaction="['process:admin:task:add']"
type="primary"
icon="el-icon-plus"
size="mini"
......@@ -58,14 +58,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-permisaction="['process:admin:classify:edit']"
v-permisaction="['process:admin:task:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>编辑</el-button>
<el-button
v-permisaction="['process:admin:classify:delete']"
v-permisaction="['process:admin:task:delete']"
size="mini"
type="text"
icon="el-icon-delete"
......@@ -123,11 +123,12 @@
<script>
import {
createClassify,
classifyList,
updateClassify,
deleteClassify
} from '@/api/process/admin/classify'
createTask,
taskList,
taskDetails,
updateTask,
deleteTask
} from '@/api/process/admin/task'
// 代码编辑器
import { codemirror } from 'vue-codemirror'
......@@ -223,81 +224,85 @@ export default {
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
taskList(this.listQuery).then(response => {
this.taskList = 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
})
},
handleQuery(val) {
this.listQuery.name = val.name
this.getList()
},
handleCreate() {
this.ruleForm = {
id: undefined,
name: ''
name: '',
classify: '',
content: ''
}
this.dialogFormVisibleName = 1
this.open = true
},
handleEdit(row) {
this.ruleForm.id = row.id
this.ruleForm.name = row.name
this.open = true
taskDetails({
file_name: row.full_name
}).then(response => {
this.ruleForm = {
name: row.name,
full_name: row.full_name,
classify: row.classify,
content: response.data
}
this.dialogFormVisibleName = 2
this.open = true
})
},
submitForm(formName) {
this.ruleForm.content = this.$refs.codemirror.content
this.$refs[formName].validate((valid) => {
if (valid) {
createClassify(this.ruleForm).then(response => {
if (response !== undefined) {
createTask(this.ruleForm).then(() => {
this.getList()
this.open = false
this.$message({
type: 'success',
message: '分类已增加!'
message: '任务脚本创建成功',
type: 'success'
})
this.open = false
}
})
}
})
},
editForm(formName) {
this.ruleForm.content = this.$refs.codemirror.content
this.$refs[formName].validate((valid) => {
if (valid) {
updateClassify(this.ruleForm).then(response => {
if (response !== undefined) {
updateTask(this.ruleForm).then(response => {
this.getList()
this.open = false
this.$message({
type: 'success',
message: '分类已更新!'
message: '任务脚本更新成功',
type: 'success'
})
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) {
deleteTask({
full_name: row.full_name
}).then(() => {
this.getList()
this.$message({
type: 'success',
message: '分类已删除!'
message: '删除成功!'
})
}
})
}).catch(() => {
this.$message({
......
......@@ -20,7 +20,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-permisaction="['process:admin:classify:add']"
v-permisaction="['process:admin:template:add']"
type="primary"
icon="el-icon-plus"
size="mini"
......@@ -59,14 +59,14 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-permisaction="['process:admin:classify:edit']"
v-permisaction="['process:admin:template:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>编辑</el-button>
<el-button
v-permisaction="['process:admin:classify:delete']"
v-permisaction="['process:admin:template:delete']"
size="mini"
type="text"
icon="el-icon-delete"
......
<template>
<div>
this is apply process.
<div class="app-container">
<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>
</template>
<script>
import { classifyProcessList } from '@/api/process/admin/process'
export default {
name: 'ApplyProcessList',
data() {
return {
processLists: [],
listQuery: {}
}
},
created() {
this.getProcessList()
},
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>
<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>
<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