审批管理修改

This commit is contained in:
2025-08-21 11:01:38 +08:00
parent b6dfdbf203
commit 963744c321
3 changed files with 520 additions and 363 deletions

View File

@@ -21,49 +21,104 @@
align="center"
width="50">
</el-table-column>
<el-table-column
prop="flowDefId"
prop="ticketsId"
header-align="center"
align="center"
label="流程定义ID">
label="工单ID">
</el-table-column>
<el-table-column
prop="flowDefName"
header-align="center"
align="center"
label="流程名称">
label="小车类型">
<template slot-scope="scope">
{{ dictData[0] | findByValue(scope.row.carType) }}
</template>
</el-table-column>
<el-table-column
prop="startDate"
header-align="center"
align="center"
label="发起时间">
label="异常类型">
<template slot-scope="scope">
{{ dictData[1] | findByValue(scope.row.errorType) }}
</template>
</el-table-column>
<el-table-column
prop="endDate"
header-align="center"
align="center"
label="结束时间">
label="合同编号">
<template slot-scope="scope">
{{ dictData[2] | findByValue(scope.row.contractId) }}
</template>
</el-table-column>
<el-table-column
prop="flowProceId"
header-align="center"
align="center"
label="实例ID">
label="客户">
<template slot-scope="scope">
{{ dictData[3] | findByValue(scope.row.clientId) }}
</template>
</el-table-column>
<el-table-column
prop="description"
header-align="center"
align="center"
label="故障描述">
</el-table-column>
<el-table-column
prop="deptPeople"
header-align="center"
align="center"
min-width="90px"
label="工单对接人">
</el-table-column>
<el-table-column
prop="deptPhone"
header-align="center"
align="center"
min-width="100px"
label="客户联系电话">
</el-table-column>
<el-table-column
prop="createUser"
header-align="center"
align="center"
label="创建者">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
min-width="90px"
label="创建时间">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="工单状态">
<template slot-scope="scope">
{{ statusOpt | findByValue(scope.row.status) }}
</template>
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
min-width="100px"
label="工单审批完成时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
width="170"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="showFlowHandle(scope.row.flowProceId)">查看流程进度</el-button>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.ticketsId)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.ticketsId)">删除</el-button>
<el-button v-if="!scope.row.status" type="text" size="small" @click="startFlowHandle(scope.row.ticketsId)">指派</el-button>
<el-button type="text" size="small" @click="$router.push(`/tickets-detail?id=${scope.row.ticketsId}`)">详情</el-button>
</template>
</el-table-column>
</el-table>
@@ -76,66 +131,83 @@
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :dictData="dictData" @refreshDataList="getDataList"></add-or-update>
<el-dialog
title="流程审批"
:visible.sync="dialogVisible"
title="发起流程"
:visible.sync="dialogFormVisible"
width="30%">
<div style="height: auto;margin-bottom: 30px;">
<el-form label-width="100px" class="demo-dynamic">
<el-form-item>
<el-button type="primary" @click="submitFlowComplete()">审批通过</el-button>
</el-form-item>
</el-form>
</div>
<el-form :model="flowForm" label-width="100px" class="demo-dynamic">
<el-form-item
v-for="(form) in dynamiForm"
:label="form.name"
:key="form.key"
:prop="form.key"
>
<el-select v-if="form.type == 'assignee'" v-model="flowForm[form.key]" placeholder="请选择">
<el-option
v-for="item in users"
:key="item.userId"
:label="item.nickname+'['+item.username+']'"
:value="item.userId">
</el-option>
</el-select>
<el-select v-if="form.type == 'candidateUsers'" v-model="flowForm[form.key]" placeholder="请选择">
<el-option
v-for="item in users"
:key="item.userId"
:label="item.nickname+'['+item.username+']'"
:value="item.userId">
</el-option>
</el-select>
<el-select v-if="form.type == 'candidateGroups'" v-model="flowForm[form.key]" placeholder="请选择">
<el-option
v-for="item in roles"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="mini" @click="dialogFormVisible = false">取消</el-button>
<el-button size="mini" type="primary" @click="submitStartFlow()">提交</el-button>
</span>
</el-dialog>
<el-dialog
title="流程图"
:visible.sync="dialogActiveVisible"
width="50%">
<div style="height: auto;margin-bottom: 30px;">
<img :src="$imgBasePath+'downloadFlowActiveImg?procId='+procInsId+'&t='+new Date()" height="auto">
</div>
<div style="padding: 50px;">
<el-steps direction="vertical" >
<el-step
v-for="item in hiTasks"
:key="item.id"
:status="item.status"
:title="item.taskNodeName+' 审批人:' + item.assigneeName +' ' + item.startTime" style="margin-bottom: 10px;"></el-step>
</el-steps>
</div>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from '../tickets/tickets-add-or-update'
import { apiUtils } from '@/utils/dict'
export default {
data () {
return {
procInsId:'',
dataForm: {
key: ''
},
dataList: [],
hiTasks:[],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
dialogVisible:false,
dialogActiveVisible:false,
id:''
dictConfigs: [{url: '/car/car/list', type: 'list', value: 'carId', label: 'carName'}, {type: 'dict', code: 'error_type'}, {url: '/flow/contract/list', type: 'list', value: 'contractId', label: 'contractNumber'}, {url: '/client/client/list', type: 'list', value: 'clientId', label: 'clientName'}],
dictData: [],
dialogFormVisible: false,
flowForm:{ticketsId: null},
dynamiForm:[],
users: [],
roles: [],
statusOpt: [{value: '0', label: '未开始'}, {value: '1', label: '已指派'}, {value: '2', label: '处理中'}, {value: '3', label: '已完成'}]
}
},
mixins: [apiUtils],
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
@@ -144,9 +216,10 @@
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/flw/instance/myStartTaskList'),
method: 'get',
params: this.$http.adornParams({
url: this.$http.adornUrl('/tickets/tickets/listType'),
method: 'post',
params: this.$http.adornData({
'type': 'ASSIGN',
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
@@ -162,71 +235,6 @@
this.dataListLoading = false
})
},
approveHandle(id){
this.id = id
this.dialogVisible = true
},
showFlowHandle(procInsId){
this.procInsId = procInsId
// 通过流程实例id查询对应的流转记录
this.$http({
url: this.$http.adornUrl(`/flw/instance/getHiTaskInstance/${this.procInsId}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dialogActiveVisible = true
this.hiTasks = data.data
}
})
},
submitFlowComplete(){
// 做审批通过的操作
this.$http({
url: this.$http.adornUrl(`/flw/instance/completeFlow/${this.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dialogVisible = false
this.getDataList();
}
})
},
claimHandle(id){
this.$confirm('确定要拾取当前的任务吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/flw/instance/claimTask/${id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.getDataList();
}
})
}).catch(() => {})
},
unclaimHandle(id){
this.$confirm('确定要归还当前的任务吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/flw/instance/unclaimTask/${id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.getDataList();
}
})
}).catch(() => {})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
@@ -242,10 +250,17 @@
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
return item.ticketsId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
@@ -253,7 +268,7 @@
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/flow/flwdemodel/delete'),
url: this.$http.adornUrl('/tickets/tickets/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
@@ -271,6 +286,45 @@
}
})
}).catch(() => {})
},
startFlowHandle(id){
this.flowForm = {}
this.flowForm.ticketsId = id
this.$http({
url: this.$http.adornUrl('/flow/deploy/flowDef'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dynamiForm = [...data.data]
this.users = [...data.users]
this.roles = [...data.roles]
this.dialogFormVisible = true
}
})
},
submitStartFlow(){
// 提交表单数据
this.$http({
url: this.$http.adornUrl(`/flw/instance/startFlowInstance`),
method: 'get',
params: this.$http.adornParams(this.flowForm)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.dialogFormVisible = false
this.flowForm = {}
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}
}
}