!5 修改bpm审批表单,使用jeecg提供的方式控制字段是否可见可编辑

Merge pull request !5 from new_new_new/feature/front-permession
This commit is contained in:
new_new_new
2026-05-09 09:12:20 +00:00
committed by Gitee
7 changed files with 986 additions and 47 deletions
+10
View File
@@ -152,3 +152,13 @@ export const bgXiSpeakFeedbackImportUrl = '/bg/xispeak/bgXiSpeak/importBgXiSpeak
* 子表导出
*/
export const bgXiSpeakFeedbackExportXlsUrl = '/bg/xispeak/bgXiSpeak/exportBgXiSpeakFeedback';
// ====================== BPM表单相关API ======================
export const saveBpmForm = (params) => {
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/saveBpmForm', params }, { isTransformResponse: false });
};
export const setProcessVariable = (params) => {
return defHttp.post({ url: '/act/process/setProcessVariable', params }, { isTransformResponse: false });
};
+42 -42
View File
@@ -8,111 +8,111 @@ export const columns: BasicColumn[] = [
{
title: '习近平总书记重要讲话指示批示情况',
align: 'center',
dataIndex: 'speakStatus'
dataIndex: 'speakStatus',
},
{
title: '时间',
align: 'center',
dataIndex: 'time',
customRender: ({ text }) => {
text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
text = !text ? '' : text.length > 10 ? text.substr(0, 10) : text;
return text;
},
},
{
title: '企业负责同志批示情况',
align: 'center',
dataIndex: 'elmComment'
dataIndex: 'elmComment',
},
{
title: '学习传达研究部署情况',
align: 'center',
dataIndex: 'status'
dataIndex: 'status',
},
{
title: '责任人',
align: 'center',
dataIndex: 'responsiblePerson_dictText'
dataIndex: 'responsiblePerson_dictText',
},
{
title: '落实方案',
align: 'center',
dataIndex: 'implPlan'
dataIndex: 'implPlan',
},
{
title: '牵头部门',
align: 'center',
dataIndex: 'leadDepartment_dictText'
dataIndex: 'leadDepartment_dictText',
},
{
title: '贯彻落实措施',
align: 'center',
dataIndex: 'implMeasures'
dataIndex: 'implMeasures',
},
{
title: '会议决策数',
align: 'center',
dataIndex: 'numberOfResolutions'
dataIndex: 'numberOfResolutions',
},
{
title: '落实情况',
align: 'left',
dataIndex: 'implStatus'
dataIndex: 'implStatus',
},
{
title: '落实条数',
align: 'center',
dataIndex: 'implCount'
dataIndex: 'implCount',
},
{
title: '已闭环数量',
align: 'center',
dataIndex: 'closedCount'
dataIndex: 'closedCount',
},
{
title: '报告反馈情况',
align: 'center',
dataIndex: 'reportFeedbackStatus'
dataIndex: 'reportFeedbackStatus',
},
{
title: '是否存在完成风险(0不存在,1存在)',
align: 'center',
dataIndex: 'isCompletionRisk'
dataIndex: 'isCompletionRisk',
},
{
title: '拖期风险应对措施',
align: 'center',
dataIndex: 'delayRiskMitigation'
dataIndex: 'delayRiskMitigation',
},
{
title: '完成状态(0推进中,1已完成)',
align: 'center',
dataIndex: 'completionStatus'
dataIndex: 'completionStatus',
},
{
title: '落实部门id',
align: 'center',
dataIndex: 'implDept_dictText'
dataIndex: 'implDept_dictText',
},
{
title: '层深(最顶层节点层深为0)',
align: 'center',
dataIndex: 'treeDepth'
dataIndex: 'treeDepth',
},
{
title: '同级数据排序号',
align: 'center',
dataIndex: 'sortOrder'
dataIndex: 'sortOrder',
},
{
title: '流程引擎状态字段',
align: 'center',
dataIndex: 'bpmStatus'
dataIndex: 'bpmStatus',
},
{
title: '督办次数',
align: 'center',
dataIndex: 'supervisionCount'
dataIndex: 'supervisionCount',
},
];
@@ -166,25 +166,25 @@ export const bgXiSpeakFeedbackColumns: BasicColumn[] = [
// 高级查询数据
export const superQuerySchema = {
speakStatus: {title: '习近平总书记重要讲话指示批示情况',order: 1,view: 'text', type: 'string',},
time: {title: '时间',order: 2,view: 'date', type: 'string',},
elmComment: {title: '企业负责同志批示情况',order: 3,view: 'text', type: 'string',},
status: {title: '学习传达研究部署情况',order: 4,view: 'text', type: 'string',},
responsiblePerson: {title: '责任人',order: 5,view: 'sel_user', type: 'string',},
implPlan: {title: '落实方案',order: 6,view: 'text', type: 'string',},
leadDepartment: {title: '牵头部门',order: 7,view: 'sel_depart', type: 'string',},
implMeasures: {title: '贯彻落实措施',order: 8,view: 'text', type: 'string',},
numberOfResolutions: {title: '会议决策数',order: 9,view: 'number', type: 'number',},
implStatus: {title: '落实情况',order: 10,view: 'text', type: 'string',},
implCount: {title: '落实条数',order: 11,view: 'number', type: 'number',},
closedCount: {title: '已闭环数量',order: 12,view: 'number', type: 'number',},
reportFeedbackStatus: {title: '报告反馈情况',order: 13,view: 'text', type: 'string',},
isCompletionRisk: {title: '是否存在完成风险(0不存在,1存在)',order: 14,view: 'number', type: 'number',},
delayRiskMitigation: {title: '拖期风险应对措施',order: 15,view: 'text', type: 'string',},
completionStatus: {title: '完成状态(0推进中,1已完成)',order: 16,view: 'number', type: 'number',},
implDept: {title: '落实部门id',order: 17,view: 'sel_depart', type: 'string',},
treeDepth: {title: '层深(最顶层节点层深为0)',order: 18,view: 'number', type: 'number',},
sortOrder: {title: '同级数据排序号',order: 19,view: 'number', type: 'number',},
bpmStatus: {title: '流程引擎状态字段',order: 21,view: 'number', type: 'number',},
supervisionCount: {title: '督办次数',order: 22,view: 'number', type: 'number',},
speakStatus: { title: '习近平总书记重要讲话指示批示情况', order: 1, view: 'text', type: 'string' },
time: { title: '时间', order: 2, view: 'date', type: 'string' },
elmComment: { title: '企业负责同志批示情况', order: 3, view: 'text', type: 'string' },
status: { title: '学习传达研究部署情况', order: 4, view: 'text', type: 'string' },
responsiblePerson: { title: '责任人', order: 5, view: 'sel_user', type: 'string' },
implPlan: { title: '落实方案', order: 6, view: 'text', type: 'string' },
leadDepartment: { title: '牵头部门', order: 7, view: 'sel_depart', type: 'string' },
implMeasures: { title: '贯彻落实措施', order: 8, view: 'text', type: 'string' },
numberOfResolutions: { title: '会议决策数', order: 9, view: 'number', type: 'number' },
implStatus: { title: '落实情况', order: 10, view: 'text', type: 'string' },
implCount: { title: '落实条数', order: 11, view: 'number', type: 'number' },
closedCount: { title: '已闭环数量', order: 12, view: 'number', type: 'number' },
reportFeedbackStatus: { title: '报告反馈情况', order: 13, view: 'text', type: 'string' },
isCompletionRisk: { title: '是否存在完成风险(0不存在,1存在)', order: 14, view: 'number', type: 'number' },
delayRiskMitigation: { title: '拖期风险应对措施', order: 15, view: 'text', type: 'string' },
completionStatus: { title: '完成状态(0推进中,1已完成)', order: 16, view: 'number', type: 'number' },
implDept: { title: '落实部门id', order: 17, view: 'sel_depart', type: 'string' },
treeDepth: { title: '层深(最顶层节点层深为0)', order: 18, view: 'number', type: 'number' },
sortOrder: { title: '同级数据排序号', order: 19, view: 'number', type: 'number' },
bpmStatus: { title: '流程引擎状态字段', order: 21, view: 'number', type: 'number' },
supervisionCount: { title: '督办次数', order: 22, view: 'number', type: 'number' },
};
@@ -0,0 +1,170 @@
<template>
<div class="p-2">
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined" v-if="mainId != ''">新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-if="mainId != ''">导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls" v-if="mainId != ''">导入</j-upload-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"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作<Icon icon="mdi:chevron-down"></Icon></a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<BgXiSpeakFeedbackModal ref="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, unref, inject, watch } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import BgXiSpeakFeedbackModal from './components/BgXiSpeakFeedbackModal.vue';
import { bgXiSpeakFeedbackColumns } from './BgXiSpeak.data';
import { bgXiSpeakFeedbackList, bgXiSpeakFeedbackDelete, bgXiSpeakFeedbackDeleteBatch, bgXiSpeakFeedbackExportXlsUrl, bgXiSpeakFeedbackImportUrl } from './BgXiSpeak.api';
import { isEmpty } from '/@/utils/is';
import { useMessage } from '/@/hooks/web/useMessage';
const mainId = inject('mainId') || '';
const $message = useMessage();
const queryParam = {};
const { tableContext, onImportXls, onExportXls } = useListPage({
tableProps: {
api: bgXiSpeakFeedbackList,
columns: bgXiSpeakFeedbackColumns,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 180,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '习总书记重要讲话反馈表',
url: bgXiSpeakFeedbackExportXlsUrl,
params: {
mainId: mainId,
},
},
importConfig: {
url: () => {
return bgXiSpeakFeedbackImportUrl + '/' + unref(mainId);
},
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
const registerModal = ref();
const formRef = ref();
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4,
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
function handleAdd() {
if (isEmpty(unref(mainId))) {
$message.createMessage.warning('请选择一个主表信息');
return;
}
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
async function handleEdit(record) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
function handleDetail(record) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
async function handleDelete(record) {
await bgXiSpeakFeedbackDelete({ id: record.id }, handleSuccess);
}
async function batchHandleDelete() {
await bgXiSpeakFeedbackDeleteBatch({ ids: selectedRowKeys.value }, handleSuccess);
}
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
},
];
}
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
reload();
}
watch(mainId, () => {
queryParam['mainId'] = unref(mainId);
reload();
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center;
}
}
</style>
+1 -1
View File
@@ -75,7 +75,7 @@
const FLOW_CODE = 'dev_bg_xi_speak_001';
const FLOW_NAME = '习总书记重要讲话指示批示';
const BUSINESS_TABLE_NAME = 'bg_xi_speak';
const FORM_URL = 'bg/xispeak/components/BgXiSpeakForm';
const FORM_URL = 'bg/xispeak/components/BgXiSpeakBPMForm';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
const { createMessage } = useMessage();
@@ -0,0 +1,521 @@
<template>
<a-spin :spinning="loading">
<div class="bg-xispeak-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" v-if="hasPermission('xizhishi')">
<a-form-item label="习近平总书记重要讲话指示批示情况" name="speakStatus" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.speakStatus" :disabled="isDisabledAuth('xizhishi')" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12" v-if="hasPermission('xitime')">
<a-form-item label="时间" name="time">
<a-date-picker v-model:value="mainForm.time" 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="responsiblePerson">
<j-select-user v-model:value="mainForm.responsiblePerson" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="企业负责同志批示情况" name="elmComment" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.elmComment" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="学习传达研究部署情况" name="status" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.status" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="牵头部门" name="leadDepartment">
<j-select-dept v-model:value="mainForm.leadDepartment" :disabled="mainDisabled" :multiple="true" checkStrictly allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="落实部门" name="implDept">
<j-select-dept v-model:value="mainForm.implDept" :disabled="mainDisabled" :multiple="true" checkStrictly allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="落实方案" name="implPlan" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.implPlan" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="贯彻落实措施" name="implMeasures" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.implMeasures" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="会议决策数" name="numberOfResolutions">
<a-input-number v-model:value="mainForm.numberOfResolutions" :disabled="mainDisabled" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="落实条数" name="implCount">
<a-input-number v-model:value="mainForm.implCount" :disabled="mainDisabled" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="已闭环数量" name="closedCount">
<a-input-number v-model:value="mainForm.closedCount" :disabled="mainDisabled" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="完成状态" name="completionStatus">
<a-input v-model:value="mainForm.completionStatus" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="落实情况" name="implStatus" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-textarea v-model:value="mainForm.implStatus" :rows="3" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="报告反馈情况" name="reportFeedbackStatus" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.reportFeedbackStatus" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="拖期风险应对措施" name="delayRiskMitigation" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-input v-model:value="mainForm.delayRiskMitigation" :disabled="mainDisabled" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="督办次数" name="supervisionCount">
<a-input-number v-model:value="mainForm.supervisionCount" :disabled="mainDisabled" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="父级节点" name="pid">
<j-tree-select v-model:value="mainForm.pid" dict="bg_xi_speak,impl_status,id" pidField="pid" pidValue="0" hasChildField="has_child" :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="hasPermission('xifankui')" 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="completionStatus">
<a-input v-model:value="feedbackForm.completionStatus" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="落实情况" name="implStatus" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-textarea v-model:value="feedbackForm.implStatus" :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>
<template v-if="showProcessHandle">
<a-divider />
<div class="section-title">流程办理</div>
<a-form class="process-variable-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="子流程经办人" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-space class="sub-approve-user-row">
<a-input
v-model:value="subApproveUser"
placeholder="输入username,多个用英文逗号分隔"
allow-clear
:disabled="savingSubApproveUser"
/>
<a-button type="primary" :loading="savingSubApproveUser" @click="saveSubApproveUserVariable">保存经办人</a-button>
</a-space>
</a-form-item>
</a-col>
</a-row>
</a-form>
<TaskHandleInnerContent :form-data="formData" :claim="claim" @success="handleProcessSuccess" @claimSuccess="handleClaimSuccess" />
</template>
</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 JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
import JTreeSelect from '/@/components/Form/src/jeecg/components/JTreeSelect.vue';
import { bgXiSpeakFeedbackList, bgXiSpeakFeedbackSaveOrUpdate, saveBpmForm, setProcessVariable } from '../BgXiSpeak.api';
import { usePermission } from '/@/hooks/web/usePermission';
import TaskHandleInnerContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskHandleInnerContent.vue';
const { isDisabledAuth, hasPermission, initBpmFormData } = usePermission();
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true },
claim: { type: Boolean, default: false },
});
initBpmFormData(props.formData);
const emit = defineEmits(['ok', 'success', 'claimSuccess']);
const { createMessage } = useMessage();
const queryByIdUrl = '/bg/xispeak/bgXiSpeak/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 savingSubApproveUser = ref(false);
const showFeedbackForm = ref(false);
const feedbackList = ref<any[]>([]);
const subApproveUser = ref('');
const mainForm = reactive<Record<string, any>>({
id: '',
pid: '',
speakStatus: '',
time: '',
elmComment: '',
status: '',
responsiblePerson: '',
needSdwApproval: '',
sdwLeaderList: '',
implPlan: '',
leadDepartment: '',
implMeasures: '',
numberOfResolutions: undefined,
implStatus: '',
implCount: undefined,
closedCount: undefined,
reportFeedbackStatus: '',
isCompletionRisk: undefined,
delayRiskMitigation: '',
completionStatus: '',
implDept: '',
treeDepth: undefined,
sortOrder: undefined,
bpmStatus: '',
supervisionCount: undefined,
});
const feedbackForm = reactive<Record<string, any>>({
id: '',
responDeptid: '',
responDeptname: '',
responPersonid: '',
responPersonname: '',
implStatus: '',
completionStatus: '',
mainId: '',
});
const feedbackRules = {
implStatus: [{ required: true, message: '请输入落实情况' }],
};
const feedbackColumns = [
{ title: '反馈部门名称', dataIndex: 'responDeptname', align: 'center', width: 160 },
{ title: '反馈人姓名', dataIndex: 'responPersonname', align: 'center', width: 140 },
{ title: '落实情况', dataIndex: 'implStatus', align: 'left', width: 280 },
{ title: '完成状态', dataIndex: 'completionStatus', align: 'center', width: 120 },
];
const mainDisabled = computed(() => {
if (props.formBpm) {
return props.formData?.disabled !== false;
}
return props.formDisabled;
});
const showProcessHandle = computed(() => props.formBpm && !!props.formData?.taskId);
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 bgXiSpeakFeedbackList({ 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;
const res = await saveBpmForm({
processInstanceId,
varField: 'json_data',
formData: { ...mainForm },
});
if (res.success) {
if (processInstanceId && (mainForm.needSdwApproval != null || mainForm.sdwLeaderList)) {
const varTasks = [];
if (mainForm.needSdwApproval != null) {
varTasks.push(
setProcessVariable({
processInstanceId,
taskId: processInfo.value.taskId,
local: true,
varField: 'needSdwApproval',
varVal: String(mainForm.needSdwApproval),
})
);
}
if (mainForm.sdwLeaderList) {
varTasks.push(
setProcessVariable({
processInstanceId,
taskId: processInfo.value.taskId,
local: true,
varField: 'sdwLeaderList',
varVal: mainForm.sdwLeaderList,
})
);
}
if (varTasks.length > 0) {
await Promise.all(varTasks);
}
}
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 bgXiSpeakFeedbackSaveOrUpdate({ ...feedbackForm }, false);
if (res.success) {
createMessage.success(res.message || '保存成功');
cancelFeedback();
await loadFeedbackList();
} else {
createMessage.warning(res.message || '保存失败');
}
} finally {
savingFeedback.value = false;
}
}
async function saveSubApproveUserVariable() {
const processInstanceId = processInfo.value.processInstanceId;
const usernameValue = normalizeUsernameList(subApproveUser.value);
if (!processInstanceId) {
createMessage.warning('流程实例ID不能为空');
return;
}
if (!usernameValue) {
createMessage.warning('请输入子流程经办人username');
return;
}
savingSubApproveUser.value = true;
try {
const res = await setProcessVariable({
processInstanceId,
taskId: processInfo.value.taskId,
local: true,
varField: 'subApproveUser',
varVal: usernameValue,
});
if (res.success) {
createMessage.success(res.message || '保存成功');
} else {
createMessage.warning(res.message || '保存失败');
}
} finally {
savingSubApproveUser.value = false;
}
}
function normalizeUsernameList(value: string) {
return String(value || '')
.split(',')
.map((item) => item.trim())
.filter(Boolean)
.join(',');
}
function handleProcessSuccess() {
emit('success');
}
function handleClaimSuccess() {
emit('claimSuccess');
}
defineExpose({
submitForm,
initFormData,
loadFeedbackList,
});
</script>
<style lang="less" scoped>
.bg-xispeak-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;
}
.process-variable-form {
margin-bottom: 12px;
}
.sub-approve-user-row {
display: flex;
width: 100%;
:deep(.ant-input-affix-wrapper),
:deep(.ant-input) {
min-width: 280px;
}
}
.main-actions {
display: flex;
justify-content: center;
gap: 12px;
margin-top: 8px;
}
</style>
@@ -0,0 +1,178 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form class="antd-modal-form" v-bind="formItemLayout" ref="formRef" name="BgXiSpeakFeedbackForm">
<a-row>
<a-col :span="12">
<a-form-item label="反馈部门" v-bind="validateInfos.responDeptid" name="responDeptid">
<j-select-dept v-model:value="formData.responDeptid" :multiple="true" checkStrictly allow-clear @change="handleDeptChange" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="反馈人" v-bind="validateInfos.responPersonid" name="responPersonid">
<j-select-user v-model:value="formData.responPersonid" allow-clear @change="handleUserChange" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="反馈时间" v-bind="validateInfos.responTime" name="responTime">
<a-date-picker placeholder="请选择反馈时间" v-model:value="formData.responTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="落实情况" v-bind="validateInfos.implStatus" name="implStatus">
<a-input v-model:value="formData.implStatus" placeholder="请输入落实情况" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="完成状态" v-bind="validateInfos.completionStatus" name="completionStatus">
<a-input v-model:value="formData.completionStatus" placeholder="请输入完成状态" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="外键" name="mainId" style="display: none">
<a-input v-model:value="formData.mainId" placeholder="请输入外键" allow-clear></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, inject, unref } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { getValueType } from '/@/utils';
import { bgXiSpeakFeedbackSaveOrUpdate } from '../BgXiSpeak.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
const mainId = inject('mainId');
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
responDeptid: '',
responDeptname: '',
responPersonid: '',
responPersonname: '',
responTime: '',
implStatus: '',
completionStatus: '',
mainId: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
const validatorRules = {};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
const props = defineProps({
disabled: { type: Boolean, default: false },
});
const formItemLayout = {
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
};
/**
* 部门选择变化
*/
function handleDeptChange(value, row) {
if (row) {
formData.responDeptname = row.name || '';
}
}
/**
* 用户选择变化
*/
function handleUserChange(value, row) {
if (row) {
formData.responPersonname = row.realname || row.name || '';
}
}
function add() {
edit({});
}
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key];
}
});
Object.assign(formData, tmpData);
});
}
async function submitForm() {
try {
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
let model = formData;
if (model.id) {
isUpdate.value = true;
}
for (let data in model) {
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
if (unref(mainId)) {
model['mainId'] = unref(mainId);
}
await bgXiSpeakFeedbackSaveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
setMainId,
});
function setMainId(id) {
formData.mainId = id;
}
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>
@@ -0,0 +1,60 @@
<template>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<BgXiSpeakFeedbackForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></BgXiSpeakFeedbackForm>
</j-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import BgXiSpeakFeedbackForm from './BgXiSpeakFeedbackForm.vue';
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
registerForm.value.setMainId(unref(mainId));
});
}
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
function handleOk() {
registerForm.value.submitForm();
}
function submitCallback() {
handleCancel();
emit('success');
}
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
.jee-hidden {
display: none !important;
}
</style>