架构化审批表单控制权限,添加xispeak审批节点的控制权限说明,修改反馈表单查看格式,修改树形表单实现正确的折叠效果,实现反馈表单的必填字段校验

This commit is contained in:
wsm
2026-05-22 16:25:56 +08:00
parent 3164645b19
commit f13064784b
10 changed files with 648 additions and 334 deletions
+135 -216
View File
@@ -30,6 +30,9 @@
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
<div class="table-title-search">
<j-select-dept v-model:value="searchDeptIds" placeholder="选择牵头部门" allow-clear style="width: 100%" @change="handleDeptSearch" />
</div>
</template>
<!--操作栏-->
@@ -40,49 +43,7 @@
<template v-slot:bodyCell="{ column, record, index, text }"> </template>
</BasicTable>
<div v-if="selectedFeedbackId" class="feedback-standalone-panel">
<div class="feedback-expand-header">
<div class="feedback-expand-title">
<span class="feedback-expand-icon">
<Icon icon="ant-design:message-outlined" />
</span>
<span>反馈信息</span>
<a-tag class="feedback-expand-count" color="processing">
{{ getFeedbackTableLoading(selectedFeedbackRecord) ? '加载中' : `${getFeedbackCount(selectedFeedbackRecord)}` }}
</a-tag>
</div>
<div class="feedback-expand-actions">
<a-button type="link" size="small" @click="handleCloseFeedback">收起反馈信息</a-button>
</div>
</div>
<BasicTable
class="feedback-inner-table"
bordered
size="small"
rowKey="id"
:canResize="false"
:showIndexColumn="false"
:showActionColumn="false"
:showTableSetting="false"
:clickToRowSelect="false"
:columns="feedbackExpandColumns"
:dataSource="getFeedbackTableData(selectedFeedbackRecord)"
:loading="getFeedbackTableLoading(selectedFeedbackRecord)"
:pagination="false"
:scroll="{ x: 1220 }"
>
<template #feedbackAttachments="{ record: feedbackRecord }">
<SUploadFile
v-if="feedbackRecord.id"
class="feedback-attachment-list"
:bussiness-id="feedbackRecord.id"
:disabled="true"
:multiple="true"
/>
<span v-else>-</span>
</template>
</BasicTable>
</div>
<BgXiSpeakFeedbackViewModal ref="feedbackViewModalRef" />
<!-- 表单区域 -->
<BgXiSpeakModal ref="registerModal" @success="handleSuccess"></BgXiSpeakModal>
<!-- 审批记录 -->
@@ -96,20 +57,21 @@
<script lang="ts" name="bg.xispeak-bgXiSpeak" setup>
import { ref, reactive, unref, computed, provide } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import type { BasicColumn } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { startProcessSchedules } from '/@/api/common/api';
import { dateUtil } from '/@/utils/dateUtil';
import Icon from '/@/components/Icon/index';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import BgXiSpeakModal from './components/BgXiSpeakModal.vue';
import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue';
import BusinessProcessListModal from '/src/components/semri/process/BusinessProcessListModal.vue';
import FlowScheduleStartModal from '/src/components/semri/process/FlowScheduleStartModal.vue';
import FeedbackRightNowModal from './components/FeedbackRightNowModal.vue';
import BgXiSpeakFeedbackViewModal from './components/BgXiSpeakFeedbackViewModal.vue';
import { columns as taskTaskColumns } from '/@/views/taskProcess/TaskTask.data';
import { columns, superQuerySchema, bgXiSpeakFeedbackColumns } from './BgXiSpeak.data';
import { columns, superQuerySchema } from './BgXiSpeak.data';
import {
list,
deleteBgXiSpeak,
@@ -120,8 +82,9 @@
getChildListBatch,
updateLaunchType,
saveOrUpdateDict,
bgXiSpeakFeedbackList,
withDrawXiSpeak,
getRootListWithDept,
bgXiSpeakFeedbackList,
} from './BgXiSpeak.api';
const FLOW_CODE = 'dev_bg_xi_speak_001';
@@ -133,32 +96,16 @@
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
const { createMessage } = useMessage();
const expandedRowKeys = ref([]);
const queryParam = ref<any>({});
const queryParams = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const flowScheduleModalRef = ref();
const feedbackViewModalRef = ref();
const feedbackRightNowModalRef = ref();
const businessProcessListModalRef = ref();
const currentBusinessId = ref('');
const pendingFeedbackRightNow = ref(0);
const processColumns = taskTaskColumns;
const selectedFeedbackId = ref<string | number | null>(null);
const feedbackTableData = reactive<Record<string, Recordable[]>>({});
const feedbackTableLoading = reactive<Record<string, boolean>>({});
// 注册table数据
const feedbackExpandColumns: BasicColumn[] = [
...bgXiSpeakFeedbackColumns,
{
title: '附件下载',
dataIndex: 'id',
key: 'attachments',
align: 'left',
width: 340,
slots: { customRender: 'feedbackAttachments' },
},
];
// 是否显示DW领导列表选择
const showSdwLeaderSelect = computed(() => queryParam.value.needSdwApproval === '1');
@@ -189,15 +136,31 @@
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] =
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource, setTableData }, { rowSelection, selectedRowKeys }] =
tableContext;
const selectedFeedbackRecord = computed(() => {
if (!selectedFeedbackId.value) return {};
return findTableDataRecord(selectedFeedbackId.value) || { id: selectedFeedbackId.value };
});
const mainId = computed(() => (unref(selectedRowKeys).length > 0 ? unref(selectedRowKeys)[0] : ''));
provide('mainId', mainId);
const searchDeptIds = ref([]);
const isDeptSearching = ref(false);
async function handleDeptSearch(value) {
if (!value || (Array.isArray(value) && value.length === 0)) {
isDeptSearching.value = false;
reload();
return;
}
const deptIds = Array.isArray(value) ? value.join(',') : value;
try {
const res = await getRootListWithDept(deptIds);
isDeptSearching.value = true;
const records = res?.records || res || [];
setTableData(records);
} catch (e) {
createMessage.error('按部门查询失败');
}
}
const labelCol = reactive({
xs: 24,
sm: 4,
@@ -317,6 +280,9 @@
result = result.records ? result.records : result;
if (result && result.length > 0) {
record.children = getDataByResult(result);
await refreshFeedbackCounts(record.children);
// 触发表格重新渲染
updateTableDataRecord(record.id, { ...record });
} else {
record.children = null;
record.hasChild = '0';
@@ -345,11 +311,77 @@
}
}
/**
* 递归收集所有 ID(含子节点)
*/
function collectAllIds(records) {
const ids: string[] = [];
const walk = (list) => {
if (!list) return;
for (const item of list) {
if (item.id) ids.push(item.id);
if (item.children) walk(item.children);
}
};
walk(records);
return ids;
}
/**
* 批量查询反馈统计数量并更新到 records 中
*/
async function refreshFeedbackCounts(records) {
const ids = collectAllIds(records);
if (ids.length === 0) return;
try {
// 并行加载所有记录的反馈数据
const results = await Promise.all(
ids.map((id) =>
bgXiSpeakFeedbackList({
mainId: id,
pageNo: 1,
pageSize: 9999,
column: 'createTime',
order: 'desc',
}).catch(() => null)
)
);
// 构建 id -> { total, closed } 映射
const countsMap: Record<string, { total: number; closed: number }> = {};
ids.forEach((id, index) => {
const res = results[index];
const list = Array.isArray(res) ? res : res?.records || [];
const total = list.length;
const closed = list.filter((item: any) => item.completionStatus == 1).length;
countsMap[id] = { total, closed };
});
const updateFn = (list) => {
if (!list) return;
for (const item of list) {
const counts = countsMap[item.id];
if (counts) {
item.implCount = counts.total;
item.closedCount = counts.closed;
}
if (item.children) updateFn(item.children);
}
};
updateFn(records);
} catch (e) {
// 静默处理查询异常
}
}
/**
* 接口请求成功后回调
*/
function onFetchSuccess(result) {
async function onFetchSuccess(result) {
getDataByResult(result.items) && loadDataByExpandedRows();
if (result.items && result.items.length > 0) {
await refreshFeedbackCounts(result.items);
// 触发表格重新渲染以显示更新后的 implCount / closedCount
setTableData([...getDataSource()]);
}
}
/**
@@ -450,11 +482,11 @@
},
auth: 'bg.xispeak:bg_xi_speak:delete',
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
},
// {
// label: '审批进度',
// onClick: handlePreviewPic.bind(null, record),
// ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
// },
{
label: '查询督办流程',
onClick: handleQueryProcess.bind(null, record),
@@ -469,7 +501,7 @@
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
},
{
label: selectedFeedbackId.value === record.id ? '收起反馈信息' : '查看反馈',
label: '查看反馈',
onClick: handleViewFeedback.bind(null, record),
},
];
@@ -604,6 +636,24 @@
return;
}
// 查询已有反馈记录,按部门获取处理人姓名
const deptHandlerMap = new Map<string, string>();
try {
const feedbackRes = await bgXiSpeakFeedbackList({ mainId: record.id, pageNo: 1, pageSize: 999 });
const feedbackRecords = feedbackRes?.records || feedbackRes?.result?.records || [];
for (const fb of feedbackRecords) {
const fbDeptIds = splitDeptValue(fb.responDeptid);
const handlerName = fb.responPersonname || '';
for (const fbDeptId of fbDeptIds) {
if (fbDeptId && handlerName && !deptHandlerMap.has(fbDeptId)) {
deptHandlerMap.set(fbDeptId, handlerName);
}
}
}
} catch (e) {
// 查询反馈失败则继续,deptHandlerName 留空
}
let successCount = 0;
const total = selectedDeptIds.length;
@@ -628,6 +678,7 @@
urgencyLevel: record.completionStatus,
deptId: deptId,
deptLeaderId: deptId,
deptHandlerName: deptHandlerMap.get(deptId) || '',
requireFinishDate: formatDate(record.time, 'YYYY-MM-DD'),
deadline: record.deadline || formatDate(record.time, 'YYYY-MM-DD HH:mm:ss'),
},
@@ -683,53 +734,8 @@
});
}
function getFeedbackKey(record: Recordable) {
return String(record?.id ?? '');
}
function getFeedbackTableData(record: Recordable) {
return feedbackTableData[getFeedbackKey(record)] || [];
}
function getFeedbackCount(record: Recordable) {
return getFeedbackTableData(record).length;
}
function getFeedbackTableLoading(record: Recordable) {
return !!feedbackTableLoading[getFeedbackKey(record)];
}
function handleCloseFeedback() {
selectedFeedbackId.value = null;
}
async function loadFeedbackTableData(mainId: string | number) {
const key = String(mainId);
feedbackTableLoading[key] = true;
try {
const res = await bgXiSpeakFeedbackList({
mainId,
pageNo: 1,
pageSize: 9999,
column: 'createTime',
order: 'desc',
});
feedbackTableData[key] = Array.isArray(res) ? res : res?.records || [];
} finally {
feedbackTableLoading[key] = false;
}
}
async function handleViewFeedback(record: Recordable) {
const mainId = record.id;
if (selectedFeedbackId.value === mainId) {
selectedFeedbackId.value = null;
} else {
selectedFeedbackId.value = mainId;
if (!feedbackTableData[mainId] || feedbackTableData[mainId].length === 0) {
await loadFeedbackTableData(mainId);
}
}
feedbackViewModalRef.value.open(record);
}
/**
@@ -759,97 +765,10 @@
</script>
<style lang="less" scoped>
.feedback-standalone-panel {
margin: 12px 0;
padding: 12px 14px 14px;
background: #f6fbff;
border: 1px solid #d6e8ff;
border-left: 4px solid #1677ff;
border-radius: 6px;
.feedback-expand-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.feedback-expand-title {
display: inline-flex;
align-items: center;
min-width: 0;
color: #1f2937;
font-size: 14px;
font-weight: 600;
line-height: 24px;
}
.feedback-expand-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
margin-right: 8px;
color: #1677ff;
background: #e6f4ff;
border-radius: 50%;
}
.feedback-expand-count {
margin-left: 10px;
}
.feedback-expand-actions {
display: flex;
align-items: center;
}
:deep(.jeecg-basic-table) {
background: #fff;
}
:deep(.feedback-inner-table .ant-table-wrapper) {
padding: 0;
border-radius: 4px;
}
:deep(.feedback-inner-table .ant-table-thead > tr > th) {
background: #eef6ff;
color: #334155;
font-weight: 600;
}
:deep(.feedback-inner-table .ant-table-tbody > tr > td) {
background: #fff;
}
:deep(.feedback-inner-table .ant-table-tbody > tr:hover > td) {
background: #f8fbff;
}
.feedback-attachment-list {
min-width: 300px;
:deep(.file-list-wrapper) {
min-height: auto;
padding: 8px;
}
:deep(.file-list-header) {
margin-bottom: 6px;
padding-bottom: 6px;
}
:deep(.file-list .file-item) {
padding: 8px;
margin-bottom: 6px;
}
:deep(.ant-empty) {
margin: 0;
}
}
.table-title-search {
display: inline-flex;
align-items: center;
margin-left: 8px;
width: 280px;
}
</style>