!26 docs(bpm): 新增showIsNeedLeaderApprove权限配置项

* docs(bpm): 新增showIsNeedLeaderApprove权限配置项
* feat(bpm): 新增是否需要所领导审批及分管所领导流程变量控制
This commit is contained in:
new_new_new
2026-06-09 09:23:15 +00:00
parent 6b7587b38a
commit 868e14749d
2 changed files with 88 additions and 8 deletions
@@ -75,7 +75,8 @@
</a-col>
<a-col :span="12">
<a-form-item label="分管所领导" name="chargeLeaderId">
<j-select-user v-model:value="mainForm.chargeLeaderId" :disabled="mainDisabled" allow-clear />
<a-input v-if="mainDisabled" :value="mainForm.chargeLeaderId" disabled />
<j-select-user v-else v-model:value="mainForm.chargeLeaderId" allow-clear />
</a-form-item>
</a-col>
<a-col :span="12">
@@ -217,6 +218,23 @@
</a-col>
</a-row>
</a-form>
<a-form v-if="showIsNeedLeaderApprove" class="process-variable-form" labelAlign="left" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="是否需要所领导审批" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<a-radio-group v-model:value="isNeedLeaderApprove" :disabled="savingIsNeedLeaderApprove">
<a-radio :value="0">不需要</a-radio>
<a-radio :value="1">需要所领导审批</a-radio>
</a-radio-group>
</a-form-item>
</a-col>
<a-col v-if="showIsNeedLeaderApproveSelector" :span="12">
<a-form-item label="分管所领导" :labelCol="wideLabelCol" :wrapperCol="wideWrapperCol">
<j-select-user v-model:value="leaderApproveUser" :disabled="savingIsNeedLeaderApprove" allow-clear />
</a-form-item>
</a-col>
</a-row>
</a-form>
<TaskHandleInnerContent
:form-data="formData"
:claim="claim"
@@ -278,6 +296,9 @@
const isEnd = ref(0);
const problemTreeData = ref<any[]>([]);
const loadingProblemOptions = ref(false);
const isNeedLeaderApprove = ref(0);
const leaderApproveUser = ref('');
const savingIsNeedLeaderApprove = ref(false);
const mainForm = reactive<Record<string, any>>({
id: '',
@@ -365,7 +386,11 @@
const showSubApproveUser = computed(
() => String(props.formData?.extendUrlParams?.showSubApproveUser ?? '') === '1'
);
const showIsNeedLeaderApprove = computed(
() => String(props.formData?.extendUrlParams?.showIsNeedLeaderApprove ?? '') === '1'
);
const showSubApproveUserSelector = computed(() => showSubApproveUser.value && String(isEnd.value) !== '1');
const showIsNeedLeaderApproveSelector = computed(() => showIsNeedLeaderApprove.value && String(isNeedLeaderApprove.value) === '1');
const processInfo = computed(() => ({
taskId: props.formData?.taskId,
@@ -400,6 +425,14 @@
{ immediate: true }
);
watch(
() => props.formData?.vars?.isNeedLeaderApprove,
(value) => {
isNeedLeaderApprove.value = String(value ?? '0') === '1' ? 1 : 0;
},
{ immediate: true }
);
async function loadProblemTree() {
loadingProblemOptions.value = true;
try {
@@ -419,6 +452,7 @@
await loadProblemTree();
const data = await defHttp.get({ url: queryByIdUrl, params: { id: dataId } });
setMainForm(data || {});
leaderApproveUser.value = mainForm.chargeLeaderId || '';
await loadFeedbackList();
} finally {
loading.value = false;
@@ -497,7 +531,12 @@
if (!mainSaved) return false;
}
if (showSubApproveUser.value) {
return saveSubApproveUserVariable({ showSuccessMessage: false });
const result = await saveSubApproveUserVariable({ showSuccessMessage: false });
if (!result) return false;
}
if (showIsNeedLeaderApprove.value) {
const result = await saveIsNeedLeaderApproveVariable({ showSuccessMessage: false });
if (!result) return false;
}
return true;
}
@@ -579,6 +618,44 @@
.join(',');
}
async function saveIsNeedLeaderApproveVariable(options: { showSuccessMessage?: boolean } = {}) {
const { showSuccessMessage = true } = options;
const processInstanceId = processInfo.value.processInstanceId;
const isNeedLeaderApproveValue = String(isNeedLeaderApprove.value);
const leaderUsernameValue = normalizeUsernameList(leaderApproveUser.value);
if (!processInstanceId) {
createMessage.warning('流程实例ID不能为空');
return false;
}
if (isNeedLeaderApproveValue === '1' && !leaderUsernameValue) {
createMessage.warning('请选择分管所领导');
return false;
}
savingIsNeedLeaderApprove.value = true;
try {
const result = await saveProcessVariable('is_need_leader_approve', isNeedLeaderApproveValue);
if (!result?.success) {
createMessage.warning(result.message || '保存失败');
return false;
}
if (isNeedLeaderApproveValue === '1') {
const leaderResult = await saveProcessVariable('leader_approve_user', leaderUsernameValue);
if (!leaderResult?.success) {
createMessage.warning(leaderResult.message || '保存失败');
return false;
}
}
if (showSuccessMessage) createMessage.success('保存成功');
return true;
} catch {
createMessage.warning('保存失败');
return false;
} finally {
savingIsNeedLeaderApprove.value = false;
}
}
function handleProcessSuccess() {
emit('success');
}