yxk-20260429-新增流程专用的党委会表单,用于流程流转专用

This commit is contained in:
ye1023
2026-04-29 10:10:27 +08:00
parent 98d7368c18
commit 20ac017020
2 changed files with 387 additions and 1 deletions
@@ -75,7 +75,7 @@
const FLOW_CODE = 'dev_task_task_001';
const FLOW_NAME = '党委会决议事项';
const BUSINESS_TABLE_NAME = 'bg_partymatter';
const FORM_URL = 'bg/bgpartymatter/components/BgPartymatterForm';
const FORM_URL = 'bg/bgpartymatter/components/BgPartymatterBPMForm';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
const formRef = ref();
@@ -0,0 +1,386 @@
<template>
<a-spin :spinning="loading">
<div class="bg-partymatter-bpm-form">
<a-form class="main-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :model="mainForm">
<div class="section-title">基础信息</div>
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="事项名称" name="title" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.title" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="会议决议" name="content" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-textarea v-model:value="mainForm.content" :rows="3" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="年份" name="year">
<a-input v-model:value="mainForm.year" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="密级" name="secretLevel">
<a-input v-model:value="mainForm.secretLevel" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="序号" name="number">
<a-input v-model:value="mainForm.number" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="会议时间" name="matterTime">
<a-date-picker v-model:value="mainForm.matterTime" value-format="YYYY-MM-DD" :disabled="mainDisabled" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="事项目录编码" name="matterCode">
<a-input v-model:value="mainForm.matterCode" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="责任部门" name="responDeptid">
<j-select-dept v-model:value="mainForm.responDeptid" :disabled="mainDisabled" :multiple="true" checkStrictly allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="要求完成日期" name="deadline">
<a-date-picker v-model:value="mainForm.deadline" value-format="YYYY-MM-DD" :disabled="mainDisabled" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="紧急程度" name="urgencyLevel">
<a-input v-model:value="mainForm.urgencyLevel" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="督办次数" name="superviseCount">
<a-input v-model:value="mainForm.superviseCount" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="完成状态" name="bpmStatus">
<a-input v-model:value="mainForm.bpmStatus" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="实际执行情况" name="actualExect" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-textarea v-model:value="mainForm.actualExect" :rows="3" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
</a-row>
<div v-if="!mainDisabled" class="main-actions">
<a-button type="primary" :loading="savingMain" @click="submitForm">保存主表数据</a-button>
</div>
</a-form>
<a-divider />
<div class="feedback-header">
<div class="section-title">反馈信息</div>
<a-button v-if="!mainDisabled" type="primary" @click="showFeedbackForm = true">新增反馈</a-button>
</div>
<a-table
rowKey="id"
size="small"
bordered
:columns="feedbackColumns"
:data-source="feedbackList"
:pagination="false"
:scroll="{ x: 900 }"
/>
<a-form
v-if="showFeedbackForm && !mainDisabled"
ref="feedbackFormRef"
class="feedback-form"
:model="feedbackForm"
:rules="feedbackRules"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
>
<div class="section-title">新增反馈</div>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="责任部门ID" name="responDeptid">
<a-input v-model:value="feedbackForm.responDeptid" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="责任部门名称" name="responDeptname">
<a-input v-model:value="feedbackForm.responDeptname" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="反馈人ID" name="responPersonid">
<a-input v-model:value="feedbackForm.responPersonid" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="反馈人姓名" name="responPersonname">
<a-input v-model:value="feedbackForm.responPersonname" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="完成状态" name="bpmStatus">
<a-input v-model:value="feedbackForm.bpmStatus" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="实际完成时间" name="actualTime">
<a-date-picker v-model:value="feedbackForm.actualTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="实际执行情况" name="actualExect" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-textarea v-model:value="feedbackForm.actualExect" :rows="3" allow-clear />
</a-form-item>
</a-col>
</a-row>
<div class="main-actions">
<a-button @click="cancelFeedback">取消</a-button>
<a-button type="primary" :loading="savingFeedback" @click="saveFeedback">保存反馈</a-button>
</div>
</a-form>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import { bgPartymatterFeedbackList, bgPartymatterFeedbackSaveOrUpdate, saveOrUpdate } from '../BgPartymatter.api';
import { usePermission } from '/@/hooks/web/usePermission';
const { isDisabledAuth, hasPermission, initBpmFormData} = usePermission();
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true },
});
initBpmFormData(props.formData);
const emit = defineEmits(['ok']);
const { createMessage } = useMessage();
const queryByIdUrl = '/bgpartymatter/bgPartymatter/queryById';
const labelCol = { xs: { span: 24 }, sm: { span: 7 } };
const wrapperCol = { xs: { span: 24 }, sm: { span: 17 } };
const wideLabelCol = { xs: { span: 24 }, sm: { span: 3 } };
const wideWrapperCol = { xs: { span: 24 }, sm: { span: 21 } };
const feedbackFormRef = ref();
const loading = ref(false);
const savingMain = ref(false);
const savingFeedback = ref(false);
const showFeedbackForm = ref(false);
const feedbackList = ref<any[]>([]);
const mainForm = reactive<Record<string, any>>({
id: '',
year: '',
secretLevel: '',
number: '',
matterTime: '',
title: '',
content: '',
matterCode: '',
responDeptid: '',
actualExect: '',
bpmStatus: '',
superviseCount: '',
deadline: '',
urgencyLevel: '',
isNeedAppro: '',
supDeptleaderid: '',
isNeedSuoleader: '',
suoleaderid: '',
isNeedInterval: '',
startCount: '',
intervalType: '',
intervalStartTime: '',
});
const feedbackForm = reactive<Record<string, any>>({
id: '',
responDeptid: '',
responDeptname: '',
responPersonid: '',
responPersonname: '',
actualExect: '',
actualTime: '',
bpmStatus: '',
mainId: '',
});
const feedbackRules = {
actualExect: [{ required: true, message: '请输入实际执行情况' }],
};
const feedbackColumns = [
{ title: '责任部门名称', dataIndex: 'responDeptname', align: 'center', width: 160 },
{ title: '反馈人姓名', dataIndex: 'responPersonname', align: 'center', width: 140 },
{ title: '实际执行情况', dataIndex: 'actualExect', align: 'left', width: 280 },
{ title: '实际完成时间', dataIndex: 'actualTime', align: 'center', width: 180 },
{ title: '完成状态', dataIndex: 'bpmStatus', align: 'center', width: 120 },
];
const mainDisabled = computed(() => {
if (props.formBpm) {
return props.formData?.disabled !== false;
}
return props.formDisabled;
});
const processInfo = computed(() => ({
taskId: props.formData?.taskId,
taskDefKey: props.formData?.taskDefKey,
processInstanceId: props.formData?.procInsId || props.formData?.processInstanceId || props.formData?.vars?.BPM_INST_ID,
processDataId: props.formData?.processDataId,
processTableName: props.formData?.processTableName,
}));
onMounted(() => {
initFormData();
});
watch(
() => props.formData?.dataId,
() => initFormData()
);
async function initFormData() {
const dataId = props.formData?.dataId;
if (!dataId) {
return;
}
loading.value = true;
try {
const data = await defHttp.get({ url: queryByIdUrl, params: { id: dataId } });
setMainForm(data || {});
await loadFeedbackList();
} finally {
loading.value = false;
}
}
function setMainForm(record: Record<string, any>) {
Object.keys(mainForm).forEach((key) => {
mainForm[key] = record[key] ?? '';
});
}
async function loadFeedbackList() {
if (!mainForm.id) {
feedbackList.value = [];
return;
}
const res = await bgPartymatterFeedbackList({ mainId: mainForm.id, pageNo: 1, pageSize: 999 });
feedbackList.value = res?.records || res?.result?.records || [];
}
async function submitForm() {
savingMain.value = true;
try {
const processInstanceId = processInfo.value.processInstanceId;
console.log('BgPartymatter BPM process info', { ...processInfo.value, processInstanceId });
const res = await saveOrUpdate({ ...mainForm }, true);
if (res.success) {
createMessage.success(res.message || '保存成功');
emit('ok');
} else {
createMessage.warning(res.message || '保存失败');
}
} finally {
savingMain.value = false;
}
}
function cancelFeedback() {
showFeedbackForm.value = false;
resetFeedbackForm();
}
function resetFeedbackForm() {
Object.keys(feedbackForm).forEach((key) => {
feedbackForm[key] = '';
});
feedbackForm.mainId = mainForm.id;
nextTick(() => feedbackFormRef.value?.clearValidate?.());
}
async function saveFeedback() {
if (!mainForm.id) {
createMessage.warning('主表数据不存在,无法新增反馈');
return;
}
await feedbackFormRef.value?.validate?.();
savingFeedback.value = true;
try {
feedbackForm.mainId = mainForm.id;
const res = await bgPartymatterFeedbackSaveOrUpdate({ ...feedbackForm }, false);
if (res.success) {
createMessage.success(res.message || '保存成功');
cancelFeedback();
await loadFeedbackList();
} else {
createMessage.warning(res.message || '保存失败');
}
} finally {
savingFeedback.value = false;
}
}
defineExpose({
submitForm,
initFormData,
loadFeedbackList,
});
</script>
<style lang="less" scoped>
.bg-partymatter-bpm-form {
padding: 12px 16px 20px;
}
.main-form,
.feedback-form {
background: #fff;
}
.section-title {
margin-bottom: 12px;
padding-left: 8px;
border-left: 3px solid #1677ff;
color: #1f2937;
font-size: 15px;
font-weight: 600;
line-height: 18px;
}
.feedback-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.feedback-form {
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
.main-actions {
display: flex;
justify-content: center;
gap: 12px;
margin-top: 8px;
}
</style>