@@ -1,6 +1,7 @@
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { queryFormTypeByProcessId, queryFormBizCodeByProcessid, list } from './node.auth.api';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { list as listProcessNodes, queryRejectTargets } from '../processNode/process.node.api';
|
||||
|
||||
/**
|
||||
* 用于字段权限配置
|
||||
@@ -129,11 +130,44 @@ export function useAuthButton(activeFormType, activeTableName) {
|
||||
|
||||
});
|
||||
|
||||
function initButtonStatus(record) {
|
||||
// 驳回目标节点配置
|
||||
const rejectTargetList = ref<Array<{ processId: string; sourceNodeCode: string; targetNodeCode: string; targetNodeName: string }>>([]);
|
||||
// 当前流程所有节点
|
||||
const allProcessNodes = ref<Array<{ processNodeCode: string; processNodeName: string }>>([]);
|
||||
|
||||
async function fetchRejectTargets(processId: string, sourceNodeCode: string) {
|
||||
if (!processId || !sourceNodeCode) return;
|
||||
try {
|
||||
const result = await queryRejectTargets({ processId, sourceNodeCode });
|
||||
rejectTargetList.value = result || [];
|
||||
} catch {
|
||||
rejectTargetList.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchAllProcessNodes(processId: string) {
|
||||
if (!processId) return;
|
||||
try {
|
||||
const result = await listProcessNodes({ processId, pageSize: 500 });
|
||||
allProcessNodes.value = (result.records || []).map((r) => ({
|
||||
processNodeCode: r.processNodeCode,
|
||||
processNodeName: r.processNodeName,
|
||||
}));
|
||||
} catch {
|
||||
allProcessNodes.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
async function initButtonStatus(record) {
|
||||
Object.keys(buttonStatus).map((k) => {
|
||||
console.log(record[k]);
|
||||
buttonStatus[k] = record[k];
|
||||
});
|
||||
// 加载驳回目标配置
|
||||
if (record.processId && record.processNodeCode) {
|
||||
await fetchAllProcessNodes(record.processId);
|
||||
await fetchRejectTargets(record.processId, record.processNodeCode);
|
||||
}
|
||||
}
|
||||
|
||||
function handleChangeFormEditStatus(value) {
|
||||
@@ -184,5 +218,8 @@ export function useAuthButton(activeFormType, activeTableName) {
|
||||
buttonStatus,
|
||||
initButtonStatus,
|
||||
handleChangeFormEditStatus,
|
||||
rejectTargetList,
|
||||
allProcessNodes,
|
||||
fetchRejectTargets,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user