mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
审批流优化
This commit is contained in:
@@ -25,7 +25,11 @@
|
||||
<!-- {{ historyList }} -->
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button v-if="applyDetail.status == 1" type="primary" @click="onSubmit">
|
||||
<el-button
|
||||
v-if="applyDetail.status == 1 || applyDetail.status == 4"
|
||||
type="primary"
|
||||
@click="onSubmit"
|
||||
>
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button type="primary" @click="submit"> 通过 </el-button>
|
||||
<el-button type="primary" @click="submit"> 确定 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -84,10 +84,10 @@
|
||||
link
|
||||
@click="OpenViewForm(row)"
|
||||
>
|
||||
{{ row.status == 1 ? '编辑' : '预览' }}
|
||||
{{ row.status == 1 || row.status == 4 ? '编辑' : '预览' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status == 1 && row.formValue"
|
||||
v-if="(row.status == 1 || row.status == 4) && row.formValue"
|
||||
v-perms="['admin:flow:flow_apply:edit']"
|
||||
type="primary"
|
||||
link
|
||||
|
||||
@@ -63,6 +63,8 @@ const props = defineProps({
|
||||
default: true
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
// const props = defineProps({
|
||||
// save: {
|
||||
@@ -105,6 +107,7 @@ function open(applyId) {
|
||||
}
|
||||
function BeforeClose() {
|
||||
dialogVisible.value = false
|
||||
emit('close')
|
||||
}
|
||||
function submit() {
|
||||
flow_history_back(formData).then(() => {
|
||||
|
||||
@@ -99,7 +99,8 @@ function onSubmit() {
|
||||
defineExpose({
|
||||
open,
|
||||
disableWidgets,
|
||||
hideWidgets
|
||||
hideWidgets,
|
||||
closeFn
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
151
admin/src/views/flow/flow_history/components/apply_submit.vue
Normal file
151
admin/src/views/flow/flow_history/components/apply_submit.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:fullscreen="false"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:destroy-on-close="true"
|
||||
:title="title"
|
||||
top="1px"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
label-position="top"
|
||||
label-width="110px"
|
||||
:rules="formRules"
|
||||
>
|
||||
<!-- {{ userTask }} -->
|
||||
<el-form-item v-if="userTask" :label="`${userTask?.label}节点审批人`" prop="templateId">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-if="approverUserList.length"
|
||||
v-model="formData.applyUserId"
|
||||
placeholder="请选择审批人"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in approverUserList"
|
||||
:key="index"
|
||||
:label="item.nickname"
|
||||
:value="item.id"
|
||||
clearable
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="审批意见" prop="passRemark" v-if="props.showRemark">
|
||||
<el-input
|
||||
v-model="formData.passRemark"
|
||||
:rows="2"
|
||||
type="textarea"
|
||||
placeholder="请输入审批意见"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-steps direction="horizontal" :active="next_nodes.length">
|
||||
<el-step :title="node.label" v-for="node of next_nodes" :key="node.id" />
|
||||
</el-steps> -->
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button type="primary" @click="submit"> 通过 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import {
|
||||
flow_history_next_node,
|
||||
flow_history_get_approver,
|
||||
flow_history_pass
|
||||
} from '@/api/flow/flow_history'
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
showRemark: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
const dialogVisible = ref(false)
|
||||
// const props = defineProps({
|
||||
// save: {
|
||||
// type: Function,
|
||||
// default: () => {}
|
||||
// }
|
||||
// })
|
||||
|
||||
class formDataState {
|
||||
id = ''
|
||||
passRemark = ''
|
||||
applyUserId = ''
|
||||
}
|
||||
const formData = reactive(new formDataState())
|
||||
const next_nodes = ref([])
|
||||
const userTask = computed(() => {
|
||||
return next_nodes.value.find((item) => item.type == 'bpmn:userTask')
|
||||
})
|
||||
const approverUserList = ref([])
|
||||
const formRules = {
|
||||
applyUserId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
}
|
||||
function open(applyId) {
|
||||
console.log('open')
|
||||
Object.assign(formData, new formDataState())
|
||||
formData.id = applyId
|
||||
dialogVisible.value = true
|
||||
|
||||
flow_history_next_node({
|
||||
applyId: applyId
|
||||
}).then((res) => {
|
||||
console.log('res', res)
|
||||
next_nodes.value = res
|
||||
})
|
||||
flow_history_get_approver({ applyId: applyId }).then((user) => {
|
||||
console.log('user', user)
|
||||
approverUserList.value = user
|
||||
if (user && user.length == 1) {
|
||||
formData.applyUserId = user[0].id
|
||||
}
|
||||
})
|
||||
}
|
||||
function BeforeClose() {
|
||||
dialogVisible.value = false
|
||||
|
||||
// formData = {}
|
||||
}
|
||||
function submit() {
|
||||
console.log('submit', next_nodes)
|
||||
|
||||
if (userTask.value && !formData.applyUserId) {
|
||||
feedback.msgWarning('请选择审批人')
|
||||
return
|
||||
}
|
||||
flow_history_pass({
|
||||
applyId: formData.id,
|
||||
nextNodeAdminId: formData.applyUserId || 0,
|
||||
passRemark: formData.passRemark
|
||||
}).then(() => {
|
||||
BeforeClose()
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// body {
|
||||
// margin: 0; /* 如果页面出现垂直滚动条,则加入此行CSS以消除之 */
|
||||
// }
|
||||
</style>
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
<ViewForm ref="viewFormRef" :save="SaveViewForm" @back="OpenBack"></ViewForm>
|
||||
|
||||
<Back ref="backRef"></Back>
|
||||
<Back ref="backRef" @close="closeBack"></Back>
|
||||
|
||||
<ApplySubmit ref="ApplySubmitRef" title="审批" @close="getLists"></ApplySubmit>
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@ import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import useUserStore from '@/stores/modules/user'
|
||||
import ApplySubmit from '@/views/flow/flow_apply/components/apply_submit.vue'
|
||||
import ApplySubmit from './components/apply_submit.vue'
|
||||
import ViewForm from './components/ViewForm.vue'
|
||||
import Back from './components/Back.vue'
|
||||
const userStore = useUserStore()
|
||||
@@ -134,7 +134,7 @@ const SaveViewForm = (historyId, form_data) => {
|
||||
feedback.msgSuccess('保存成功')
|
||||
await getLists()
|
||||
|
||||
const row = pager.lists.find((item) => item.id === historyId)
|
||||
const row = pager.lists.find((item: any) => item.id === historyId)
|
||||
|
||||
OpenApplySubmit(row)
|
||||
resolve(true)
|
||||
@@ -155,6 +155,11 @@ const OpenBack = async (row: any) => {
|
||||
|
||||
backRef.value?.open(row.applyId)
|
||||
}
|
||||
const closeBack = () => {
|
||||
console.log('closeBack')
|
||||
|
||||
viewFormRef.value?.closeFn()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user