yxk-20260421-通用发起流程组件

This commit is contained in:
ye1023
2026-04-21 19:12:19 +08:00
parent 3a49966dac
commit 55f91ba764
2 changed files with 203 additions and 46 deletions
@@ -51,36 +51,36 @@
<BgPartymatterModal ref="registerModal" @success="handleSuccess" />
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
<FlowScheduleStartModal ref="flowScheduleModalRef" @confirm="handleFlowScheduleConfirm" />
</div>
</template>
<script lang="ts" name="bgpartymatter-bgPartymatter" setup>
import { ref, reactive, computed, unref, provide } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import { BasicTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { useModal } from '/@/components/Modal';
import { dateUtil } from '/@/utils/dateUtil';
import BgPartymatterModal from './components/BgPartymatterModal.vue'
import { columns, superQuerySchema } from './BgPartymatter.data';
import { list, deleteOne, batchDelete, getImportUrl,getExportUrl } from './BgPartymatter.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useMessage } from '/@/hooks/web/useMessage';
import JSwitch from '/@/components/Form/src/jeecg/components/JSwitch.vue';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
import { startProcessSchedules } from '/@/api/common/api';
import BgPartymatterModal from './components/BgPartymatterModal.vue';
import BgPartymatterFeedbackList from './BgPartymatterFeedbackList.vue';
import FlowScheduleStartModal from '/src/components/semri/process/FlowScheduleStartModal.vue';
import { columns, superQuerySchema } from './BgPartymatter.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './BgPartymatter.api';
const FLOW_CODE = 'dev_task_task_001';
const BUSINESS_TABLE_NAME = 'bg_partymatter';
const FORM_URL = 'bgpartymatter/components/BgPartymatterForm';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
import BgPartymatterFeedbackList from './BgPartymatterFeedbackList.vue'
import { useUserStore } from '/@/store/modules/user';
import {startProcessSchedules} from "@/api/common/api";
const formRef = ref();
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const registerModal = ref();
const userStore = useUserStore();
const flowScheduleModalRef = ref();
const queryParam = reactive<any>({});
const { createMessage } = useMessage();
//注册table数据
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
//注册table数据
const { tableContext, onExportXls, onImportXls } = useListPage({
tableProps:{
title: '党委会',
api: list,
@@ -212,56 +212,66 @@
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
},
];
if(record.bpmStatus == '1' || !record.bpmStatus){
if (record.bpmStatus == '1' || !record.bpmStatus) {
dropDownAction.push({
label: '发起流程',
popConfirm: {
title: '确认提交流程吗?',
confirm: handleProcess.bind(null, record),
placement: 'topLeft',
}
})
onClick: handleProcess.bind(null, record),
});
}
return dropDownAction;
}
/**
* 提交流程
*/
async function handleProcess(record) {
function handleProcess(record) {
flowScheduleModalRef.value?.open({
title: 'Start Flow',
payload: { record },
initialValues: {
triggerType: record.isNeedInterval, //1立即督办,2重复督办
intervalType: record.intervalType,
startCount: record.startCount,
intervalStartTime: record.intervalStartTime ? dateUtil(record.intervalStartTime).format('YYYY-MM-DD HH:mm:ss') : undefined,
},
});
}
async function handleFlowScheduleConfirm({ payload, options }) {
const record = payload?.record || {};
const formatDate = (value, format) => {
return value ? dateUtil(value).format(format) : undefined;
};
const params = {
intervalType: record.intervalType ? Number(record.intervalType) : undefined,
startCount: record.startCount ? Number(record.startCount) : undefined,
intervalType: options.intervalType,
startCount: options.startCount,
taskTask: {
flowCode: 'dev_task_task_001',
triggerType: record.isNeedInterval, //1立即督办,2重复督办
flowCode: FLOW_CODE,
triggerType: options.triggerType,
businessId: record.id,
businessTablename: 'bg_partymatter',
businessTablename: BUSINESS_TABLE_NAME,
title: record.title,
content: record.content,
urgencyLevel: record.urgencyLevel,
deptId: record.responDeptid,
requireFinishDate: formatDate(record.deadline, 'YYYY-MM-DD'),
startTime: formatDate(record.intervalStartTime, 'YYYY-MM-DD HH:mm:ss'),
startTime: options.intervalStartTime,
deadline: formatDate(record.deadline, 'YYYY-MM-DD HH:mm:ss'),
formUrl: 'bgpartymatter/components/BgPartymatterForm',
formUrl: FORM_URL,
},
}
};
await startProcessSchedules(params);
createMessage.success('流程发起成功');
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_bg_partymatter_001',
dataId: record.id,
});
}
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: FLOW_CODE,
dataId: record.id,
});
}
/* ----------------------以下为原生查询需要添加的-------------------------- */
const toggleSearchStatus = ref<boolean>(false);
const labelCol = reactive({
@@ -297,6 +307,7 @@
}
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;