调整合同待办已办功能

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">
import { Page } from '@vben/common-ui';
import TodoPage from '../../components/todo-page/todo-page.vue';
</script>
<template>
<TodoPage :module="['contractSetup']" />
<Page content-class="h-full">
<TodoPage :module="['contractSetup']" />
</Page>
</template>
<style scoped></style>

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, reactive } from 'vue';
import { onMounted, reactive, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
@ -26,6 +26,46 @@ const { xGridRef: xGrid2Ref, triggerProxy: triggerProxy2 } = useVxeTable({
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 - 表格 */
const gridOptions = reactive(
gridProps({
@ -98,77 +138,75 @@ function toDetail(type: string, id: string, row?: any) {
onMounted(() => {});
//
defineExpose({});
</script>
<template>
<Page content-class="h-full flex flex-col">
<a-space class="flex h-full flex-col" direction="vertical" size="small">
<a-card
:body-style="{ flex: '1' }"
class="flex h-full flex-col"
size="small"
title="待办"
>
<vxe-grid ref="xGridRef" v-bind="gridOptions">
<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,
flowInstanceId: row.flowInstanceId,
})
"
>
查看
</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">
<template #toolbar_buttons> </template>
<template #title_slot="{ row }">
<span>
{{ row.contractName }}
</span>
</template>
<template #operate="{ row }">
<a-button
class="text-blue-500"
size="small"
type="text"
@click="
toDetailPage('approval', '', {
contractId: row.contractId,
flowInstanceId: row.flowInstanceId,
})
"
>
查看
</a-button>
</template>
</vxe-grid>
</a-card>
</a-space>
</Page>
<a-space class="flex h-full flex-col" direction="vertical" size="small">
<a-card
:body-style="{ flex: '1' }"
class="flex h-full flex-col"
size="small"
title="待办"
>
<vxe-grid ref="xGridRef" v-bind="gridOptions">
<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,
flowInstanceId: row.flowInstanceId,
})
"
>
查看
</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">
<template #toolbar_buttons> </template>
<template #title_slot="{ row }">
<span>
{{ row.contractName }}
</span>
</template>
<template #operate="{ row }">
<a-button
class="text-blue-500"
size="small"
type="text"
@click="
toDetailPage('approval', '', {
contractId: row.contractId,
flowInstanceId: row.flowInstanceId,
})
"
>
查看
</a-button>
</template>
</vxe-grid>
</a-card>
</a-space>
</template>
<style scoped>

View File

@ -5,84 +5,25 @@ import { Page } from '@vben/common-ui';
import Apis from '#/api';
import { useVxeTable } from '#/hooks/vxeTable';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getTodoColumns } from '#/views/contract/schema';
import { toDetailPage } from '#/views/contract/utils';
import { useRouter } from 'vue-router';
import { DICT_TYPE, getDictDatasAsync, getDictOptions } from '#/utils/dict';
import TodoPage from '#/views/contract/components/todo-page/todo-page.vue';
const router = useRouter();
const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: 'xGridRef' });
const { xGridRef: xGrid2Ref, triggerProxy: triggerProxy2 } = useVxeTable({
ref: 'xGrid2Ref',
});
const treeData = ref();
const todoPageRef = ref();
const selectedKeys = ref<string[]>([]);
/** Hooks - 表格 */
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,
},
}),
);
let treeKeys = ref([]);
/** Hooks - 表格 */
const grid2Options = reactive(
gridProps({
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');
function onTreeSelect(e) {
console.log(e);
treeKeys.value = e;
}
const expandedKeys = ref<string[]>([]);
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) => {
item.key = item.value;
item.title = item.label;
@ -92,22 +33,6 @@ async function loadDataByDictType() {
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(() => {
loadDataByDictType();
});
@ -131,63 +56,7 @@ onMounted(() => {
</a-card>
</a-col>
<a-col :span="19" class="min-w-700px flex flex-col">
<a-card
: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>
<TodoPage ref="todoPageRef" v-model:module="treeKeys"></TodoPage>
</a-col>
</a-row>
</Page>