Commit 0ab0fc2e by YuleiLan

添加工单列表

parent b4e5f57c
<template>
<div>
this is all.
<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.title"
placeholder="请输入工单标题"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="getList"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="getList">搜索</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" border :data="ticketList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="120" />
<el-table-column label="标题" prop="title" :show-overflow-tooltip="true" />
<el-table-column label="当前状态" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.state[0].label }}</span>
</template>
</el-table-column>
<el-table-column label="当前处理人" prop="principals" :show-overflow-tooltip="true" />
<el-table-column label="是否结束" :show-overflow-tooltip="true" width="80" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_end===0" size="mini" type="success"></el-tag>
<el-tag v-else size="mini" type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="create_time" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.create_time) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<template slot-scope="scope">
<el-button
v-permisaction="['process:admin:classify:edit']"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleView(scope.row)"
>查看</el-button>
<el-button
v-permisaction="['process:admin:classify:edit']"
size="mini"
type="text"
icon="el-icon-position"
@click="handleInversion(scope.row)"
>转交</el-button>
<el-button
v-permisaction="['process:admin:classify:edit']"
size="mini"
type="text"
icon="el-icon-switch-button"
@click="handleUnity(scope.row)"
>结单</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
title="转交工单"
:visible.sync="dialogVisible"
width="30%"
>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="60px" class="demo-ruleForm">
<el-form-item label="节点" prop="node_id">
<el-select v-model="ruleForm.node_id" placeholder="选择节点" size="small" style="width: 100%">
<el-option v-for="(item, index) in nodeList" :key="index" :label="item.label" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="用户" prop="user_id">
<el-select v-model="ruleForm.user_id" placeholder="选择用户" size="small" style="width: 100%">
<el-option v-for="(item, index) in users" :key="index" :label="item.nickname" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="ruleForm.remarks" type="textarea" size="small" />
</el-form-item>
<el-form-item style="text-align: right">
<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
<el-button @click="dialogVisible = false">关闭</el-button>
</el-form-item>
</el-form>
</el-dialog>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageIndex"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { workOrderList, unityWorkOrder, inversionWorkOrder } from '@/api/process/work-order'
import { listUser } from '@/api/system/sysuser'
export default {
data() {
return {
users: [],
nodeList: [],
dialogVisible: false,
queryParams: {},
total: 0,
loading: false,
ticketList: [],
listQuery: {
page: 1,
per_page: 10
},
ruleForm: {
work_order_id: '',
node_id: '',
user_id: '',
remarks: ''
},
rules: {
node_id: [
{ required: true, message: '请选择节点', trigger: 'change' }
],
user_id: [
{ required: true, message: '请选择用户', trigger: 'change' }
]
}
}
},
created() {
this.getList()
},
methods: {
getList() {
this.loading = true
this.listQuery.page = this.queryParams.pageIndex
this.listQuery.per_page = this.queryParams.pageSize
this.listQuery.classify = 4
workOrderList(this.listQuery).then(response => {
console.log(response)
this.ticketList = 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
})
},
handleView(row) {
this.$router.push({ name: 'ProcessListHandle', query: { workOrderId: row.id, processId: row.process }})
},
handleUnity(row) {
console.log(row)
this.$confirm('此操作将会结束该工单, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
unityWorkOrder({
work_oroder_id: row.id
}).then(response => {
if (response.code === 100000) {
this.getList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
})
})
},
handleInversion(row) {
this.dialogVisible = true
this.ruleForm.work_order_id = row.id
this.nodeList = row.state
if (this.nodeList.length === 1) {
this.ruleForm.node_id = this.nodeList[0].id
}
listUser({
pageSize: 999999
}).then(response => {
this.users = response.data.list
})
},
handleSelectionChange() {},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
inversionWorkOrder(this.ruleForm).then(response => {
if (response.code === 100000) {
this.getList()
this.dialogVisible = false
}
})
}
})
}
}
}
</script>
......
......@@ -2,10 +2,10 @@
<div class="app-container">
<el-card class="box-card">
<el-form ref="listQuery" :model="listQuery" :inline="true">
<el-form-item label="分类名称">
<el-form-item label="流程名称">
<el-input
v-model="listQuery.name"
placeholder="请输入分类名称"
placeholder="请输入流程名称"
clearable
size="small"
style="width: 240px"
......
......@@ -3,7 +3,7 @@
<el-card class="box-card">
<div class="text item">
<el-steps :active="active" finish-status="success">
<template v-for="(item, index) in processStructure.nodes">
<template v-for="(item, index) in processStructureValue.nodes">
<el-step
v-if="item.isHideNode === false ||
item.isHideNode === undefined ||
......@@ -34,18 +34,19 @@
<span>表单信息</span>
</div>
<div class="text item">
<k-form-build
v-for="(tplItem, tplIndex) in processStructure.tpls"
<fm-generate-form
v-for="(tplItem, tplIndex) in processStructureValue.tpls"
:key="tplIndex"
:ref="'kfd-' + tplItem.id"
:value="JSON.parse(tplItem.form_structure)"
:ref="'generateForm-'+tplItem.id"
:remote="remoteFunc"
:data="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"
v-for="(item, index) in processStructureValue.edges"
v-show="item.source===processStructureValue.nodes[active].id"
:key="index"
type="primary"
@click="submitAction(item.target)"
......@@ -58,18 +59,27 @@
</template>
<script>
import Vue from 'vue'
import {
GenerateForm
} from '@/components/VueFormMaking'
import 'form-making/dist/FormMaking.css'
Vue.component(GenerateForm.name, GenerateForm)
import {
processStructure,
createWorkOrder
} from '@/api/process/work-order'
import { listUser } from '@/api/system/sysuser'
export default {
name: 'Create',
data() {
return {
active: 0,
processStructure: {},
processStructureValue: {},
ruleForm: {
title: '',
title: '123',
process: '',
classify: '',
state: [],
......@@ -86,6 +96,17 @@ export default {
title: [
{ required: true, message: '请输入工单标题', trigger: 'blur' }
]
},
remoteFunc: {
// 获取用户列表
getUserListFunc(resolve) {
listUser({
pageSize: 999999
}).then(response => {
const options = response.data.list
resolve(options)
})
}
}
}
},
......@@ -97,7 +118,7 @@ export default {
processStructure({
processId: this.$route.query.processId
}).then(response => {
this.processStructure = response.data
this.processStructureValue = response.data
})
},
submitAction(target) {
......@@ -105,10 +126,10 @@ export default {
if (valid) {
var stateMap = {}
this.ruleForm.process = parseInt(this.$route.query.processId)
this.ruleForm.classify = this.processStructure.process.classify
this.ruleForm.classify = this.processStructureValue.process.classify
stateMap['id'] = target
this.ruleForm.source_state = this.processStructure.nodes[this.active].label
for (var v of this.processStructure.nodes) {
this.ruleForm.source_state = this.processStructureValue.nodes[this.active].label
for (var v of this.processStructureValue.nodes) {
if (v.id === target) {
if (v.assignType !== undefined) {
stateMap['process_method'] = v.assignType
......@@ -127,10 +148,10 @@ export default {
'form_data': []
}
// 绑定流程任务
this.ruleForm.tasks = this.processStructure.process.tasks === undefined ? [] : this.processStructure.process.tasks
this.ruleForm.tasks = this.processStructureValue.process.tasks === undefined ? [] : this.processStructureValue.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.processStructureValue.nodes[this.active].task !== undefined && this.processStructureValue.nodes[this.active].task.length > 0) {
for (var task of this.processStructureValue.nodes[this.active].task) {
if (this.ruleForm.tasks.indexOf(task) === -1) {
this.ruleForm.tasks.push(task)
}
......@@ -138,16 +159,16 @@ export default {
}
var promiseList = []
for (var tpl of this.processStructure.tpls) {
for (var tpl of this.processStructureValue.tpls) {
this.ruleForm.tpls.form_structure.push(tpl.form_structure)
promiseList.push(this.$refs['kfd-' + tpl.id][0].getData())
promiseList.push(this.$refs['generateForm-' + tpl.id][0].getData())
}
Promise.all(promiseList).then(values => {
this.ruleForm.source = this.processStructure.nodes[this.active].id
this.ruleForm.source = this.processStructureValue.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' })
if (response.code === 200) {
this.$router.push({ path: '/process/upcoming' })
}
})
})
......
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