提交 517441ba authored 作者: kxjia's avatar kxjia

完善报送工作流

上级 0cfa28bc
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" @click="handleAdd" v-if="showAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0 && showBatch">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作 <Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction
:actions="tableActions(record)"
:dropDownActions="dropDownActions(record)"
/>
</template>
<template #htmlSlot="{ text }">
<div v-html="text"></div>
</template>
</BasicTable>
<slot name="modals"></slot>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
interface ActionItem {
label: string;
onClick?: (record: any) => void;
ifShow?: boolean;
popConfirm?: {
title: string;
confirm: () => void;
};
disabled?: boolean;
}
interface Props {
title?: string;
api: any;
columns: any[];
searchFormSchema?: any[];
canResize?: boolean;
labelWidth?: string | number;
showAdvancedButton?: boolean;
autoSubmitOnEnter?: boolean;
beforeFetch?: (params: any) => any;
actionColumn?: any;
showAdd?: boolean;
showBatch?: boolean;
getTableActions?: (record: any) => ActionItem[];
getDropDownActions?: (record: any) => ActionItem[];
deleteApi?: (data: any) => Promise<any>;
batchDeleteApi?: (data: any) => Promise<any>;
}
const props = withDefaults(defineProps<Props>(), {
title: '列表',
canResize: false,
labelWidth: '30%',
showAdvancedButton: true,
autoSubmitOnEnter: true,
showAdd: true,
showBatch: true,
});
const emit = defineEmits(['add', 'reload', 'register']);
const { tableContext } = useListPage({
tableProps: {
title: props.title,
api: props.api,
columns: props.columns,
canResize: props.canResize,
formConfig: {
labelWidth: props.labelWidth,
schemas: props.searchFormSchema || [],
autoSubmitOnEnter: props.autoSubmitOnEnter,
showAdvancedButton: props.showAdvancedButton,
},
beforeFetch: props.beforeFetch,
actionColumn: props.actionColumn || {
width: 200,
fixed: 'right',
},
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
// 组件初始化时发出 register 事件
onMounted(() => {
emit('register', {
register: registerTable,
reload,
});
});
function handleAdd() {
emit('add');
}
async function handleDelete(record: any) {
if (props.deleteApi) {
await props.deleteApi({ id: record.id });
handleSuccess();
}
}
async function batchHandleDelete() {
if (props.batchDeleteApi) {
await props.batchDeleteApi({ ids: selectedRowKeys.value });
handleSuccess();
}
}
async function handleSuccess() {
selectedRowKeys.value = [];
await reload();
emit('reload');
}
function tableActions(record: any) {
if (props.getTableActions) {
return props.getTableActions(record);
}
return [];
}
function dropDownActions(record: any) {
if (props.getDropDownActions) {
return props.getDropDownActions(record);
}
return [];
}
defineExpose({
reload,
registerTable,
});
</script>
......@@ -96,7 +96,7 @@ export const columns: BasicColumn[] = [
status = "已启动";
} else if(text==="2") {
color = "green";
status = "行中";
status = "行中";
} else {
color = "";
status = "完成";
......
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作 <Icon icon="mdi:chevron-down" /></a-button>
</a-dropdown>
<DynamicList
:title="title"
:api="api"
:columns="columns"
:searchFormSchema="searchFormSchema"
:actionColumn="actionColumn"
:beforeFetch="beforeFetch"
:getTableActions="getTableAction"
:getDropDownActions="getDropDownAction"
:deleteApi="deleteOne"
:batchDeleteApi="batchDelete"
:showBatch="false"
@add="handleAdd"
@register="handleRegister"
>
<template #modals>
<BaosongTaskModal @register="registerModal" @success="handleSuccess" />
<BaosongAllocDrawer ref="refAllocDrawer" @callback="handleSuccess" />
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<BaosongTaskModal @register="registerModal" @success="handleSuccess" />
<BaosongAllocDrawer ref="refAllocDrawer" @callback="handleSuccess" />
</DynamicList>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import BaosongTaskModal from '../form/BaosongTaskModal.vue';
import { columns, searchFormSchema } from '../data/BaosongTask.data';
import { list, deleteOne, batchDelete, saveOrUpdate } from '../api/BaosongTask.api';
import BaosongAllocDrawer from '../form/BaosongAllocDrawer.vue';
const [registerModal, { openModal }] = useModal();
const refAllocDrawer = ref();
const props = defineProps({
todoList: { type: Array as () => Recordable[], default: () => [] },
})
const { tableContext } = useListPage({
tableProps: {
title: '任务表',
api: list,
columns,
canResize: false,
formConfig: {
labelWidth: '30%',
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
beforeFetch(params) {
params['bpmStatus'] = "2";
params['todoList'] = props.todoList;
return params;
},
actionColumn: {
width: 200,
fixed: 'right',
},
},
import { ref } from 'vue';
import { useModal } from '/@/components/Modal';
import BaosongTaskModal from '../form/BaosongTaskModal.vue';
import { columns, searchFormSchema } from '../data/BaosongTask.data';
import { list, deleteOne, batchDelete, saveOrUpdate } from '../api/BaosongTask.api';
import BaosongAllocDrawer from '../form/BaosongAllocDrawer.vue';
import DynamicList from '../components/DynamicList.vue';
const [registerModal, { openModal }] = useModal();
const refAllocDrawer = ref();
let reloadTable: () => Promise<void>;
const props = defineProps({
todoList: { type: Array as () => Recordable[], default: () => [] },
});
const title = '任务表';
const api = list;
const actionColumn = {
width: 200,
fixed: 'right',
};
function beforeFetch(params: any) {
params['bpmStatus'] = "2";
params['todoList'] = props.todoList;
return params;
}
function handleRegister(params: any) {
reloadTable = params.reload;
}
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
function handleAlloc(record: Recordable) {
refAllocDrawer.value.setIniData(record);
}
function handleAlloc(record: Recordable) {
refAllocDrawer.value?.setIniData(record);
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
async function handleDelete(record: Recordable) {
await deleteOne({ id: record.id }, handleSuccess);
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
async function handleSuccess() {
selectedRowKeys.value = [];
await reload();
async function handleSuccess() {
if (reloadTable) {
await reloadTable();
}
}
function getTableAction(record: Recordable) {
return [
// {
// label: '分配',
// onClick: handleAlloc.bind(null, record),
// },
// {
// label: '提交',
// onClick: () => emit('sendWorkFlow', record),
// },
{
label: '处理',
onClick: () => emit('open-multi-form', record),
},
];
}
function getTableAction(record: Recordable) {
return [
{
label: '处理',
onClick: () => emit('open-multi-form', record),
},
];
}
function getDropDownAction(record: Recordable) {
return [
{
label: '详情',
onClick: () => handleDetail(record),
},
{
label: '编辑',
onClick: () => handleEdit(record),
},
];
}
function getDropDownAction(record: Recordable) {
return [
{
label: '详情',
onClick: () => handleDetail(record),
},
{
label: '编辑',
onClick: () => handleEdit(record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: () => handleDelete(record),
},
},
];
}
const emit = defineEmits(['sendWorkFlow', 'open-multi-form']);
const emit = defineEmits(['sendWorkFlow', 'open-multi-form']);
const handleUpdate = async (dataId: string, flowNode: Recordable) => {
const record = {
bpmNodeId: flowNode.id,
deployId: flowNode.deployId,
bpmStatus: 2,
id: dataId,
};
await saveOrUpdate(record, true);
await handleSuccess();
const handleUpdate = async (dataId: string, flowNode: Recordable) => {
const record = {
bpmNodeId: flowNode.id,
deployId: flowNode.deployId,
bpmStatus: 2,
id: dataId,
};
const handleStartUpdate = async (flowData: Recordable) => {
const record = {
procInsId: flowData.procInsId,
id: flowData.dataId,
bpmStatus: 0,
};
await saveOrUpdate(record, true);
await handleSuccess();
await saveOrUpdate(record, true);
await handleSuccess();
};
const handleStartUpdate = async (flowData: Recordable) => {
const record = {
procInsId: flowData.procInsId,
id: flowData.dataId,
bpmStatus: 0,
};
defineExpose({
handleUpdate,
handleStartUpdate,
});
</script>
\ No newline at end of file
await saveOrUpdate(record, true);
await handleSuccess();
};
defineExpose({
handleUpdate,
handleStartUpdate,
});
</script>
......@@ -49,7 +49,6 @@ public class AuditActController extends JeecgController<AuditAct, IAuditActServi
@Autowired
private IAuditActRelOthersService stActRelOthersService;
/**
* 分页列表查询
*
......
......@@ -2,6 +2,7 @@ package org.jeecg.modules.stm.baosong.controller;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import dev.langchain4j.internal.Utils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
......@@ -16,8 +17,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.stm.my.entity.MyTask;
import org.jeecg.modules.stm.my.entity.MyTaskFlow;
import org.jeecg.modules.stm.my.entity.MyTaskFlowHis;
import org.jeecg.modules.stm.my.service.IMyTaskFlowHisService;
import org.jeecg.modules.stm.my.service.IMyTaskFlowService;
import org.jeecg.modules.stm.my.service.IMyTaskService;
import org.jeecg.modules.stm.problem.entity.StProblemCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -51,6 +56,10 @@ public class BaosongTaskController extends JeecgController<BaosongTask, IBaosong
private IBaosongTaskReviewService baosongTaskReviewService;
@Autowired
private IMyTaskFlowService myTaskFlowService;
@Autowired
private IMyTaskFlowHisService myTaskFlowHisService;
@Autowired
private IMyTaskService myTaskService;
/**
* 分页列表查询
......@@ -149,13 +158,13 @@ public class BaosongTaskController extends JeecgController<BaosongTask, IBaosong
@AutoLog(value = "任务表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BaosongTask baosongTask) {
public Result<BaosongTask> add(@RequestBody BaosongTask baosongTask) {
if(baosongTask.getTp()==null){
baosongTask.setTp(1);
}
baosongTask.setSta(0);
baosongTaskService.save(baosongTask);
return Result.OK("添加成功!");
return Result.OK(baosongTask);
}
/**
......@@ -167,9 +176,9 @@ public class BaosongTaskController extends JeecgController<BaosongTask, IBaosong
@AutoLog(value = "任务表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BaosongTask baosongTask) {
public Result<BaosongTask> edit(@RequestBody BaosongTask baosongTask) {
baosongTaskService.updateById(baosongTask);
return Result.OK("编辑成功!");
return Result.OK(baosongTask);
}
/**
......@@ -183,6 +192,7 @@ public class BaosongTaskController extends JeecgController<BaosongTask, IBaosong
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) Integer id) {
baosongTaskService.removeById(id);
deleteOther(id);
return Result.OK("删除成功!");
}
......@@ -345,6 +355,23 @@ public class BaosongTaskController extends JeecgController<BaosongTask, IBaosong
QueryWrapper<BaosongTaskRecord> queryRecordWrapper = new QueryWrapper<>();
queryRecordWrapper.eq("taskid",taskId);
baosongTaskRecordService.remove(queryRecordWrapper);
LambdaQueryWrapper<MyTaskFlow> myTaskFlowWrapper = new LambdaQueryWrapper<>();
myTaskFlowWrapper.eq(MyTaskFlow::getFormTableName, "baosong_task")
.eq(MyTaskFlow::getTaskId, taskId);
myTaskFlowService.getBaseMapper().delete(myTaskFlowWrapper);
LambdaQueryWrapper<MyTask> myTaskWrapper = new LambdaQueryWrapper<>();
myTaskWrapper.eq(MyTask::getTp, 5)
.eq(MyTask::getTargetId, taskId);
myTaskService.getBaseMapper().delete(myTaskWrapper);
LambdaQueryWrapper<MyTaskFlowHis> myTaskFlowHistoryWrapper = new LambdaQueryWrapper<>();
myTaskFlowHistoryWrapper.eq(MyTaskFlowHis::getFormTableName, "baosong_task")
.eq(MyTaskFlowHis::getTaskId, taskId);
myTaskFlowHisService.getBaseMapper().delete(myTaskFlowHistoryWrapper);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论