!74 fix(bpm): 修复选人组件 Name 翻译使用错误字段及查询顺序问题
* fix(bpm): 修复选人组件 Name 翻译使用错误字段及查询顺序问题 * feat(bpm): 默认审批意见改为完全由后端节点配置驱动,移除所有写死模板 * fix(bpm): 修复节点默认审批意见配置 UI 绑定错误,支持 extraVars 变量解析 * feat(bpm): 新增条件变量默认审批意见,支持按流程变量值动态预填审批意见
This commit is contained in:
+24
-3
@@ -114,7 +114,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, reactive, computed, toRaw, unref, watch, watchEffect } from 'vue';
|
||||
import { ref, reactive, computed, toRaw, unref, watch, watchEffect, inject } from 'vue';
|
||||
import { initDictOptions } from '/@/utils/dict';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { taskComplaint, taskComplete, beforeAddSignTask, afterAddSignTask, addMultiInstance} from "../task.handle.api";
|
||||
@@ -216,6 +216,19 @@
|
||||
*/
|
||||
const selectUserType = ref('');
|
||||
const remarksDictOptions = ref([]);
|
||||
const extraVars = inject('extraVars', ref({}));
|
||||
const flowVars = inject('flowVars', ref({}));
|
||||
|
||||
function resolvePlaceholders(text) {
|
||||
if (!text) return '';
|
||||
const extra = extraVars.value || {};
|
||||
const flow = flowVars.value || {};
|
||||
return text.replace(/\$\{(\w+)\}/g, (_, key) => {
|
||||
if (key in extra) return String(extra[key] ?? '');
|
||||
return String(flow[key] ?? '');
|
||||
});
|
||||
}
|
||||
|
||||
const historyCount = computed(() => {
|
||||
return props.historyList.length;
|
||||
});
|
||||
@@ -264,9 +277,17 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
const formDefaultReason = inject('formDefaultReason', ref(''));
|
||||
|
||||
// 表单写死 > 节点配置(props.defaultReason 来自 TaskHandleInnerContent 的节点优先级链)
|
||||
const resolvedDefaultReason = computed(() => {
|
||||
const opinion = formDefaultReason.value || props.defaultReason;
|
||||
return resolvePlaceholders(opinion);
|
||||
});
|
||||
|
||||
// 默认处理意见只在空值或仍为上一条自动意见时刷新,避免覆盖用户手动输入。
|
||||
watch(
|
||||
() => props.defaultReason,
|
||||
resolvedDefaultReason,
|
||||
(value) => {
|
||||
if (isRejectProcessModel(model.processModel)) {
|
||||
return;
|
||||
@@ -279,7 +300,7 @@
|
||||
() => model.processModel,
|
||||
(value) => {
|
||||
const isReject = isRejectProcessModel(value);
|
||||
applyAutoReason(isReject ? REJECT_DEFAULT_REASON : props.defaultReason, [
|
||||
applyAutoReason(isReject ? REJECT_DEFAULT_REASON : resolvedDefaultReason.value, [
|
||||
isReject ? props.defaultReason : REJECT_DEFAULT_REASON,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user