调整合同待办已办功能

This commit is contained in:
z9130 2024-10-10 17:53:43 +08:00
parent dc87bbca61
commit 589ddf5954
3 changed files with 121 additions and 211 deletions

View File

@ -1,9 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { Page } from '@vben/common-ui';
import TodoPage from '../../components/todo-page/todo-page.vue'; import TodoPage from '../../components/todo-page/todo-page.vue';
</script> </script>
<template> <template>
<TodoPage :module="['contractSetup']" /> <Page content-class="h-full">
<TodoPage :module="['contractSetup']" />
</Page>
</template> </template>
<style scoped></style> <style scoped></style>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive } from 'vue'; import { onMounted, reactive, ref, watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
@ -26,6 +26,46 @@ const { xGridRef: xGrid2Ref, triggerProxy: triggerProxy2 } = useVxeTable({
ref: 'xGrid2Ref', ref: 'xGrid2Ref',
}); });
// emit
const emit = defineEmits<{
(e: 'update:module', value: string[]): void;
}>();
// module
const localModule = ref((props.module || []).slice()); //
//
let isInternalUpdate = false;
// props.module localModule
watch(
() => props.module,
(newVal) => {
if (!isInternalUpdate) {
// localModule
localModule.value = newVal?.slice() || [];
triggerProxy('reload'); //
triggerProxy2('reload'); //
console.log('module prop changed:', newVal);
}
//
isInternalUpdate = false;
},
{ immediate: true, deep: true },
);
// localModule
watch(
localModule,
(newValue) => {
// localModule props.module emit
if (JSON.stringify(newValue) !== JSON.stringify(props.module)) {
isInternalUpdate = true; //
emit('update:module', newValue); //
}
},
{ deep: true },
);
/** Hooks - 表格 */ /** Hooks - 表格 */
const gridOptions = reactive( const gridOptions = reactive(
gridProps({ gridProps({
@ -98,77 +138,75 @@ function toDetail(type: string, id: string, row?: any) {
onMounted(() => {}); onMounted(() => {});
// defineExpose({});
</script> </script>
<template> <template>
<Page content-class="h-full flex flex-col"> <a-space class="flex h-full flex-col" direction="vertical" size="small">
<a-space class="flex h-full flex-col" direction="vertical" size="small"> <a-card
<a-card :body-style="{ flex: '1' }"
:body-style="{ flex: '1' }" class="flex h-full flex-col"
class="flex h-full flex-col" size="small"
size="small" title="待办"
title="待办" >
> <vxe-grid ref="xGridRef" v-bind="gridOptions">
<vxe-grid ref="xGridRef" v-bind="gridOptions"> <template #toolbar_buttons> </template>
<template #toolbar_buttons> </template> <template #title_slot="{ row }">
<template #title_slot="{ row }"> <span
<span class="cursor-pointer text-blue-500 hover:underline"
class="cursor-pointer text-blue-500 hover:underline" @click="toDetail(row.module, row.businessId, row)"
@click="toDetail(row.module, row.businessId, row)" >
> {{ row.contractName }}
{{ row.contractName }} </span>
</span> </template>
</template> <template #operate="{ row }">
<template #operate="{ row }"> <a-button
<a-button class="text-blue-500"
class="text-blue-500" size="small"
size="small" type="text"
type="text" @click="
@click=" toDetailPage('approval', '', {
toDetailPage('approval', '', { contractId: row.contractId,
contractId: row.contractId, flowInstanceId: row.flowInstanceId,
flowInstanceId: row.flowInstanceId, })
}) "
" >
> 查看
查看 </a-button>
</a-button> </template>
</template> </vxe-grid>
</vxe-grid> </a-card>
</a-card> <a-card
<a-card :body-style="{ flex: '1' }"
:body-style="{ flex: '1' }" class="flex h-full flex-col"
class="flex h-full flex-col" size="small"
size="small" title="已办"
title="已办" >
> <vxe-grid ref="xGrid2Ref" v-bind="grid2Options">
<vxe-grid ref="xGrid2Ref" v-bind="grid2Options"> <template #toolbar_buttons> </template>
<template #toolbar_buttons> </template> <template #title_slot="{ row }">
<template #title_slot="{ row }"> <span>
<span> {{ row.contractName }}
{{ row.contractName }} </span>
</span> </template>
</template> <template #operate="{ row }">
<template #operate="{ row }"> <a-button
<a-button class="text-blue-500"
class="text-blue-500" size="small"
size="small" type="text"
type="text" @click="
@click=" toDetailPage('approval', '', {
toDetailPage('approval', '', { contractId: row.contractId,
contractId: row.contractId, flowInstanceId: row.flowInstanceId,
flowInstanceId: row.flowInstanceId, })
}) "
" >
> 查看
查看 </a-button>
</a-button> </template>
</template> </vxe-grid>
</vxe-grid> </a-card>
</a-card> </a-space>
</a-space>
</Page>
</template> </template>
<style scoped> <style scoped>

View File

@ -5,84 +5,25 @@ import { Page } from '@vben/common-ui';
import Apis from '#/api'; import Apis from '#/api';
import { useVxeTable } from '#/hooks/vxeTable'; import { useVxeTable } from '#/hooks/vxeTable';
import { DICT_TYPE, getDictOptions } from '#/utils/dict'; import { DICT_TYPE, getDictDatasAsync, getDictOptions } from '#/utils/dict';
import { getTodoColumns } from '#/views/contract/schema'; import TodoPage from '#/views/contract/components/todo-page/todo-page.vue';
import { toDetailPage } from '#/views/contract/utils';
import { useRouter } from 'vue-router';
const router = useRouter();
const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: 'xGridRef' });
const { xGridRef: xGrid2Ref, triggerProxy: triggerProxy2 } = useVxeTable({
ref: 'xGrid2Ref',
});
const treeData = ref(); const treeData = ref();
const todoPageRef = ref();
const selectedKeys = ref<string[]>([]); const selectedKeys = ref<string[]>([]);
/** Hooks - 表格 */ let treeKeys = ref([]);
const gridOptions = reactive(
gridProps({
columns: getTodoColumns({ type: 'todo' }),
proxyConfig: {
autoLoad: true,
ajax: {
query: ({ page }) => {
return Apis.home.get_todo({
params: {
pageNum: page.currentPage,
pageSize: page.pageSize,
moduleId: selectedKeys.value[0],
},
});
},
},
},
pagerConfig: {
enabled: true,
},
toolbarConfig: {
enabled: false,
},
}),
);
/** Hooks - 表格 */ function onTreeSelect(e) {
const grid2Options = reactive( console.log(e);
gridProps({ treeKeys.value = e;
columns: getTodoColumns({ type: 'done' }),
proxyConfig: {
autoLoad: true,
ajax: {
query: ({ page }) => {
return Apis.home.get_done({
params: {
pageNum: page.currentPage,
pageSize: page.pageSize,
moduleId: selectedKeys.value[0],
},
});
},
},
},
pagerConfig: {
enabled: true,
},
toolbarConfig: {
enabled: false,
},
}),
);
function onTreeSelect() {
triggerProxy('reload');
triggerProxy2('reload');
} }
const expandedKeys = ref<string[]>([]); const expandedKeys = ref<string[]>([]);
async function loadDataByDictType() { async function loadDataByDictType() {
const data = getDictOptions(DICT_TYPE.contract_todo_type); const dictMap = await getDictDatasAsync([DICT_TYPE.contract_todo_type]);
const data = dictMap[DICT_TYPE.contract_todo_type] || [];
data.forEach((item) => { data.forEach((item) => {
item.key = item.value; item.key = item.value;
item.title = item.label; item.title = item.label;
@ -92,22 +33,6 @@ async function loadDataByDictType() {
treeData.value = [{ title: '全部', key: 'all', children: data }]; treeData.value = [{ title: '全部', key: 'all', children: data }];
} }
function toDetail(type: string, id: string, row?: any) {
switch (type) {
case 'contractSetup': {
router.push(`/contract/approval/edit/${id}`);
break;
}
case 'selectMerchant': {
router.push(`/contract/business/edit/${row.contractId}`);
break;
}
default: {
break;
}
}
}
onMounted(() => { onMounted(() => {
loadDataByDictType(); loadDataByDictType();
}); });
@ -131,63 +56,7 @@ onMounted(() => {
</a-card> </a-card>
</a-col> </a-col>
<a-col :span="19" class="min-w-700px flex flex-col"> <a-col :span="19" class="min-w-700px flex flex-col">
<a-card <TodoPage ref="todoPageRef" v-model:module="treeKeys"></TodoPage>
:body-style="{ flex: '1' }"
class="flex h-full flex-col"
size="small"
title="待办"
>
<vxe-grid ref="xGridRef" v-bind="gridOptions" class="flex-1">
<template #toolbar_buttons> </template>
<template #title_slot="{ row }">
<span
class="cursor-pointer text-blue-500 hover:underline"
@click="toDetail(row.module, row.businessId, row)"
>
{{ row.contractName }}
</span>
</template>
<template #operate="{ row }">
<a-button
class="text-blue-500"
size="small"
type="text"
@click="
toDetailPage('approval', '', { contractId: row.contractId })
"
>
查看
</a-button>
</template>
</vxe-grid>
</a-card>
<a-card
:body-style="{ flex: '1' }"
class="flex h-full flex-col"
size="small"
title="已办"
>
<vxe-grid ref="xGrid2Ref" v-bind="grid2Options" class="flex-1">
<template #toolbar_buttons> </template>
<template #title_slot="{ row }">
<span class="">
{{ row.contractName }}
</span>
</template>
<template #operate="{ row }">
<a-button
class="text-blue-500"
size="small"
type="text"
@click="
toDetailPage('approval', '', { contractId: row.contractId })
"
>
查看
</a-button>
</template>
</vxe-grid>
</a-card>
</a-col> </a-col>
</a-row> </a-row>
</Page> </Page>