rollback
xy 10 months ago
parent 47d0b067c6
commit 0a1371bb9f

@ -201,6 +201,28 @@ export async function rollback(data,isLoading=true) {
isLoading isLoading
}) })
} }
// 退回不清除记录
export async function rollbackSimple(data,isLoading=true) {
await MessageBox.confirm("确认退回?", "提示")
return request({
method: 'post',
url: '/api/oa/flow/rollback-simple',
data,
isLoading
})
}
// 退回后重新流转方式
export function rollbackJump(data) {
return request({
url: '/api/oa/flow/rollback-jump',
method: 'post',
data
})
}
export function flowLogs(params,isLoading=false) { export function flowLogs(params,isLoading=false) {
return request({ return request({
method: 'get', method: 'get',

@ -4,10 +4,10 @@
<vxe-toolbar print custom export> <vxe-toolbar print custom export>
<template #buttons> <template #buttons>
<el-date-picker <el-date-picker
:value="select.month" v-model="select.month"
type="month" type="month"
size="small" size="small"
value-format="yyyy-MM-dd" value-format="yyyy-MM"
style="width: 160px;"> style="width: 160px;">
</el-date-picker> </el-date-picker>
<el-button icon="el-icon-search" type="primary" plain size="small" style="margin-left: 6px;" @click="getList"></el-button> <el-button icon="el-icon-search" type="primary" plain size="small" style="margin-left: 6px;" @click="getList"></el-button>

@ -41,7 +41,7 @@
</template> </template>
<script> <script>
import { flowLogs, rollback } from '@/api/flow' import { flowLogs, rollback, rollbackSimple } from '@/api/flow'
import { PopupManager } from 'element-ui/lib/utils/popup' import { PopupManager } from 'element-ui/lib/utils/popup'
import { defaultModalSize } from '@/settings' import { defaultModalSize } from '@/settings'
export default { export default {
@ -86,7 +86,8 @@ export default {
} }
try { try {
this.form.id = this.flow.id; this.form.id = this.flow.id;
const res = await rollback(this.form) const res = await rollbackSimple(this.form)
// const res = await rollback(this.form)
this.$message({ this.$message({
message: res, message: res,
duration: 2000, duration: 2000,

@ -18,8 +18,7 @@
<el-steps :space="120" finish-status="success" align-center> <el-steps :space="120" finish-status="success" align-center>
<template v-if="!isFirstNode"> <template v-if="!isFirstNode">
<el-step <el-step
v-for="step in config.logs" v-for="step in config.logs ? config.logs.slice(0, -1) : []"
v-if="(step.flow_node_id !== node.id && step.status !== -1)"
:title="step.node.name" :title="step.node.name"
:status="step.status !== -1 ? 'success' : 'error'" :status="step.status !== -1 ? 'success' : 'error'"
icon="el-icon-circle-check" icon="el-icon-circle-check"
@ -35,10 +34,14 @@
status="wait" status="wait"
> >
<template #title> <template #title>
<div style="max-width: 180px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"> <el-tooltip class="item" effect="dark" :content="(node.nextNodes && node.nextNodes instanceof Array) ? node.nextNodes.map(i => i.name).toString() : ''" placement="bottom">
<span v-for="(nextNode, index) in ((node.nextNodes && node.nextNodes instanceof Array) ? node.nextNodes : [])">{{ index === 0 ? '' : ',' }}{{ nextNode.name }}</span> <div>
</div> <div style="max-width: 180px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
<div v-if="node.nextNodes">{{ node.nextNodes.length }}</div> <span v-for="(nextNode, index) in ((node.nextNodes && node.nextNodes instanceof Array) ? node.nextNodes : [])">{{ index === 0 ? '' : ',' }}{{ nextNode.name }}</span>
</div>
<div v-if="node.nextNodes">{{ node.nextNodes.length }}</div>
</div>
</el-tooltip>
</template> </template>
</el-step> </el-step>
</el-steps> </el-steps>
@ -248,11 +251,13 @@ import { generateRandomString } from '@/utils'
import { import {
create, create,
deal, deal,
fieldConfig, flowList, fieldConfig,
flowList,
preConfig, preConfig,
preDeal, preDeal,
updateNodeTime, updateNodeTime,
view, view,
rollbackJump
} from "@/api/flow"; } from "@/api/flow";
import { deepCopy } from "@/utils"; import { deepCopy } from "@/utils";
import { validation, validationName } from "@/utils/validate"; import { validation, validationName } from "@/utils/validate";
@ -767,7 +772,35 @@ export default {
if (this.$route.query.flow_id) { if (this.$route.query.flow_id) {
copyForm["temporary_save"] = 0; copyForm["temporary_save"] = 0;
} }
callback = () => (this.isShowAssign = true); callback = () => {
if (this.isRollbackNode) {
this.$confirm('是否直接流转至退回人节点', '提示', {
distinguishCancelAndClose: true,
confirmButtonText: '流转至退回人节点',
cancelButtonText: '重新流转'
}).then(async _ => {
try {
const res = await rollbackJump({
id: this.$route.query.flow_id,
way: 2
})
this.$router.push("/flow/list/todo")
} catch (err) {
console.error(err)
}
}).catch(async(action) => {
if (action === 'cancel') {
const res = await rollbackJump({
id: this.$route.query.flow_id,
way: 1
})
this.isShowAssign = true
}
})
} else {
this.isShowAssign = true
}
};
break; break;
} }
@ -817,7 +850,7 @@ export default {
}) })
}) })
} }
}, }
}, },
computed: { computed: {
device() { device() {
@ -837,6 +870,21 @@ export default {
node() { node() {
return this.config?.currentNode || {}; return this.config?.currentNode || {};
}, },
isRollbackNode() {
if (this.config.logs && this.config.logs instanceof Array && this.config.logs?.length > 0) {
if (this.config.logs.at(-1)?.flow_node_id === this.node.id) {
if (this.config.logs.at(-2)?.hasOwnProperty('status')) {
return this.config.logs.at(-2).status === -1
} else {
return false
}
} else {
return false
}
} else {
return false
}
},
scriptContent() { scriptContent() {
if (this.config?.customModel?.view_js && this.$route.query.flow_id && /\/detail/.test(this.$route.path)) { if (this.config?.customModel?.view_js && this.$route.query.flow_id && /\/detail/.test(this.$route.path)) {
return this.config?.customModel?.view_js; return this.config?.customModel?.view_js;

@ -124,10 +124,13 @@
:row-config="{ keyField: 'id' }" :row-config="{ keyField: 'id' }"
:custom-config="{ mode: 'popup' }" :custom-config="{ mode: 'popup' }"
:data="list" :data="list"
:menu-config="menuConfig"
@cell-click="cellClickEvent" @cell-click="cellClickEvent"
@cell-dblclick="cellDblclickEvent" @cell-dblclick="cellDblclickEvent"
@checkbox-change="checkboxChange" @checkbox-change="checkboxChange"
@checkbox-all="checkboxChange" @checkbox-all="checkboxChange"
@menu-click="contextMenuClickEvent"
> >
<vxe-column type="checkbox" width="50" align="center"></vxe-column> <vxe-column type="checkbox" width="50" align="center"></vxe-column>
<vxe-column :visible="$store.getters.device === 'mobile'" field="m-operate" type="expand" title="操作" width="60" align="center"> <vxe-column :visible="$store.getters.device === 'mobile'" field="m-operate" type="expand" title="操作" width="60" align="center">
@ -486,6 +489,23 @@ export default {
}; };
}, },
methods: { methods: {
contextMenuClickEvent({ menu, row, column }) {
switch (menu.code) {
case 'edit':
//
if (row && column) {
const target = this.$router.resolve({
path: '/flow/edit',
query: {
flow_id: row.id
}
})
window.open(target.href, '_blank')
}
break
default:
}
},
cellClickEvent(e) { cellClickEvent(e) {
if (e.column?.field !== 'title') return if (e.column?.field !== 'title') return
this.listPopoverId = e.row.id this.listPopoverId = e.row.id
@ -603,6 +623,20 @@ export default {
} }
}, },
computed: { computed: {
menuConfig() {
if (this.$store.state.user.adminId === 1) {
return {
className: 'my-menus',
body: {
options: [
[
{ code: 'edit', name: '编辑', prefixConfig: { icon: 'vxe-icon-feedback' } },
],
]
}
}
}
}
}, },
watch: { watch: {
'select.custom_model_id': { 'select.custom_model_id': {

Loading…
Cancel
Save