CaiYuanYiTiHua/src/views/demo/workflow/task/myDraft.vue

147 lines
3.5 KiB
Vue
Raw Normal View History

2024-05-11 09:53:05 +08:00
<template>
<div style="width: 100%">
2024-05-11 09:53:05 +08:00
<BasicTable @register="registerTable" :searchInfo="searchInfo">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
color: 'error',
popConfirm: {
title: '是否确认删除',
confirm: () => {
handleDelete(record);
},
},
},
]"
/>
</template>
</template>
</BasicTable>
<a-modal
width="100%"
wrap-class-name="full-modal"
v-model:open="auditOpen"
title="详情"
:destroyOnClose="true"
>
<template #footer> </template>
<Initiate ref="posRef" :processId="processId" @closeModel="closeModel" />
</a-modal>
</div>
2024-05-11 09:53:05 +08:00
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { getLoadMyDraftPage, deleteDraft } from '@/api/sys/WFProcess';
import { Initiate } from './process/page';
import { useMessage } from '@/hooks/web/useMessage';
2024-06-11 16:05:50 +08:00
import { useRoute } from 'vue-router';
2024-05-11 09:53:05 +08:00
const searchInfo = reactive<Recordable>({});
const { createMessage } = useMessage();
const auditOpen = ref(false);
const processId = ref('');
2024-06-11 16:05:50 +08:00
const route = useRoute();
searchInfo.category = route.query.category;
2024-05-11 09:53:05 +08:00
const [registerTable, { reload }] = useTable({
api: getLoadMyDraftPage,
columns: [
{
title: '标题',
dataIndex: 'title',
},
{
title: '流程模版',
dataIndex: 'schemeName',
},
{
title: '提交人',
dataIndex: 'createUserName',
},
{
title: '创建时间',
dataIndex: 'createDate',
},
],
rowKey: 'id',
formConfig: {
labelWidth: 120,
schemas: [
{
field: '[StartDate, EndDate]',
label: '日期范围',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'],
},
colProps: { span: 8 },
},
{
field: 'keyWord',
label: '关键字',
component: 'Input',
colProps: { span: 8 },
},
],
},
useSearchForm: true,
showTableSetting: true,
bordered: true,
handleSearchInfoFn(info) {
return info;
},
actionColumn: {
width: 100,
title: '操作',
dataIndex: 'action',
// slots: { customRender: 'action' },
},
});
async function handleDelete(record) {
var query = {
id: record.id,
};
const data = await deleteDraft(query);
if (data) {
reload();
return createMessage.success('删除成功');
} else {
return createMessage.error('删除失败');
}
}
function handleDetail(record) {
processId.value = record.id;
auditOpen.value = true;
// go('/dashboard/task_look_preview/detail?processId=' + record.id);
}
function closeModel() {
auditOpen.value = false;
reload();
}
</script>
<style lang="less">
.full-modal {
.ant-modal {
max-width: 100%;
top: 0;
}
.ant-modal-content {
height: calc(100vh);
}
.ant-modal-body {
height: 85%;
}
}
</style>