mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat: 流程实例,查看变量功能
This commit is contained in:
@ -138,7 +138,7 @@ async function edit(row: TableDataWithIndex<Api.Workflow.WorkflowCategory>) {
|
|||||||
handleEdit(row);
|
handleEdit(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInRow(row: TableDataWithIndex<Api.Workflow.WorkflowCategory>) {
|
async function addInRow(row: TableDataWithIndex<Api.Workflow.WorkflowCategory>) {
|
||||||
editingData.value = jsonClone(row);
|
editingData.value = jsonClone(row);
|
||||||
handleAdd();
|
handleAdd();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { computed, reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
import { NButton, NDivider, NEmpty, NInput, NRadioButton, NRadioGroup, NSpin, NTag } from 'naive-ui';
|
import { NButton, NDivider, NEmpty, NInput, NRadioButton, NRadioGroup, NSpin, NTag } from 'naive-ui';
|
||||||
|
import { useBoolean, useLoading } from '@sa/hooks';
|
||||||
import { workflowActivityStatusRecord } from '@/constants/workflow';
|
import { workflowActivityStatusRecord } from '@/constants/workflow';
|
||||||
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
|
import { fetchGetCategoryTree } from '@/service/api/workflow/category';
|
||||||
import {
|
import {
|
||||||
@ -12,11 +13,11 @@ import {
|
|||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import useLoading from '@/hooks/common/loading';
|
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
import ProcessInstanceSearch from './modules/process-instance-search.vue';
|
import ProcessInstanceSearch from './modules/process-instance-search.vue';
|
||||||
|
import ProcessInstanceVariableDrawer from './modules/process-instance-variable-drawer.vue';
|
||||||
|
|
||||||
interface RunningStatusOption {
|
interface RunningStatusOption {
|
||||||
label: string;
|
label: string;
|
||||||
@ -30,6 +31,8 @@ defineOptions({
|
|||||||
useDict('wf_business_status');
|
useDict('wf_business_status');
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
const { bool: variableVisible, setTrue: showVariableDrawer } = useBoolean(false);
|
||||||
|
|
||||||
const runningStatus = ref<boolean>(true);
|
const runningStatus = ref<boolean>(true);
|
||||||
const runningStatusOptions = ref<RunningStatusOption[]>([
|
const runningStatusOptions = ref<RunningStatusOption[]>([
|
||||||
{
|
{
|
||||||
@ -146,7 +149,7 @@ const operateColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>(
|
|||||||
title: $t('common.operate'),
|
title: $t('common.operate'),
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 150,
|
width: 155,
|
||||||
render: row => {
|
render: row => {
|
||||||
const showAll = runningStatus.value;
|
const showAll = runningStatus.value;
|
||||||
const id = row.id;
|
const id = row.id;
|
||||||
@ -179,7 +182,14 @@ const operateColumns = ref<NaiveUI.TableColumn<Api.Workflow.ProcessInstance>[]>(
|
|||||||
]}
|
]}
|
||||||
<ButtonIcon text type="info" icon="material-symbols:visibility-outline" tooltipContent="流程预览" />
|
<ButtonIcon text type="info" icon="material-symbols:visibility-outline" tooltipContent="流程预览" />
|
||||||
<NDivider vertical />
|
<NDivider vertical />
|
||||||
<ButtonIcon text type="info" icon="material-symbols:variable-insert" tooltipContent="流程变量" />
|
<ButtonIcon
|
||||||
|
key=""
|
||||||
|
text
|
||||||
|
type="info"
|
||||||
|
icon="material-symbols:variable-insert"
|
||||||
|
tooltipContent="流程变量"
|
||||||
|
onClick={() => handleShowVariable(id)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -215,7 +225,7 @@ const {
|
|||||||
: [...baseColumns.value, ...finishColumns.value, ...operateColumns.value]
|
: [...baseColumns.value, ...finishColumns.value, ...operateColumns.value]
|
||||||
});
|
});
|
||||||
|
|
||||||
const { checkedRowKeys, onBatchDeleted, onDeleted } = useTableOperate(data, getData);
|
const { checkedRowKeys, editingData, handleEdit, onBatchDeleted, onDeleted } = useTableOperate(data, getData);
|
||||||
// 监听运行状态变化
|
// 监听运行状态变化
|
||||||
watch(runningStatus, async () => {
|
watch(runningStatus, async () => {
|
||||||
const newApiFn = runningStatus.value ? fetchGetRunningProcessInstanceList : fetchGetFinishedProcessInstanceList;
|
const newApiFn = runningStatus.value ? fetchGetRunningProcessInstanceList : fetchGetFinishedProcessInstanceList;
|
||||||
@ -280,8 +290,14 @@ async function handleCancel(instanceId: CommonType.IdType) {
|
|||||||
// request
|
// request
|
||||||
const { error } = await fetchFlowInvalidOperate(cancelModel);
|
const { error } = await fetchFlowInvalidOperate(cancelModel);
|
||||||
if (error) return;
|
if (error) return;
|
||||||
|
window.$message?.success('作废成功');
|
||||||
getDataByPage();
|
getDataByPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleShowVariable(id: CommonType.IdType) {
|
||||||
|
handleEdit('id', id);
|
||||||
|
showVariableDrawer();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -352,13 +368,14 @@ async function handleCancel(instanceId: CommonType.IdType) {
|
|||||||
:data="data"
|
:data="data"
|
||||||
size="small"
|
size="small"
|
||||||
:flex-height="!appStore.isMobile"
|
:flex-height="!appStore.isMobile"
|
||||||
:scroll-x="1400"
|
:scroll-x="1405"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
remote
|
remote
|
||||||
:row-key="row => row.id"
|
:row-key="row => row.id"
|
||||||
:pagination="mobilePagination"
|
:pagination="mobilePagination"
|
||||||
class="sm:h-full"
|
class="sm:h-full"
|
||||||
/>
|
/>
|
||||||
|
<ProcessInstanceVariableDrawer v-model:visible="variableVisible" :row-data="editingData" />
|
||||||
</NCard>
|
</NCard>
|
||||||
</div>
|
</div>
|
||||||
</TableSiderLayout>
|
</TableSiderLayout>
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import JsonPreview from '@/components/custom/json-preview.vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'ProcessInstanceVariableDrawer'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
rowData: Api.Workflow.ProcessInstance | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
|
const visible = defineModel<boolean>('visible', {
|
||||||
|
default: false
|
||||||
|
});
|
||||||
|
|
||||||
|
function closeDrawer() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NModal
|
||||||
|
v-model:show="visible"
|
||||||
|
title="流程变量"
|
||||||
|
preset="card"
|
||||||
|
:bordered="false"
|
||||||
|
display-directive="show"
|
||||||
|
class="max-w-90% w-600px"
|
||||||
|
@close="closeDrawer"
|
||||||
|
>
|
||||||
|
<JsonPreview :code="props.rowData?.variable"></JsonPreview>
|
||||||
|
<template #footer>
|
||||||
|
<NSpace justify="end" :size="16">
|
||||||
|
<NButton @click="closeDrawer">{{ $t('common.close') }}</NButton>
|
||||||
|
</NSpace>
|
||||||
|
</template>
|
||||||
|
</NModal>
|
||||||
|
</template>
|
Reference in New Issue
Block a user