@steedos-widgets/amis-lib 6.10.3 → 6.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +503 -162
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +504 -163
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +270 -234
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/approval_comments.d.ts +14 -0
- package/dist/types/workflow/approve.d.ts +16 -15
- package/dist/types/workflow/flow.d.ts +20 -31
- package/dist/types/workflow/instance.d.ts +1 -0
- package/dist/types/workflow/util.d.ts +17 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -2853,6 +2853,7 @@ var widget_ed = {
|
|
|
2853
2853
|
"steedos-field_type_file": "Attachment",
|
|
2854
2854
|
"steedos-field_type_formula": "Formula",
|
|
2855
2855
|
"steedos-field_type_summary": "Rollup Summary",
|
|
2856
|
+
"steedos-field_type_approval_comments": "Approval Comments",
|
|
2856
2857
|
"steedos-field_label": "Display Name",
|
|
2857
2858
|
"steedos-field_api_name": "API Name",
|
|
2858
2859
|
"steedos-field_api_name_remark": "The API name can only contain lowercase letters and numbers, must start with a letter, cannot end with an underscore or contain two consecutive underscores.",
|
|
@@ -2978,6 +2979,7 @@ var sfield_file = "附件";
|
|
|
2978
2979
|
var sfield_formula = "公式";
|
|
2979
2980
|
var sfield_summary = "累计汇总";
|
|
2980
2981
|
var sfield_table = "表格";
|
|
2982
|
+
var sfield_approval_comments = "审批意见";
|
|
2981
2983
|
var sfield_settings_panel_title = "设置";
|
|
2982
2984
|
var sfield_control_advanced = "高级";
|
|
2983
2985
|
var sfield_control_general = "通用";
|
|
@@ -3150,6 +3152,7 @@ var widget_zh = {
|
|
|
3150
3152
|
sfield_formula: sfield_formula,
|
|
3151
3153
|
sfield_summary: sfield_summary,
|
|
3152
3154
|
sfield_table: sfield_table,
|
|
3155
|
+
sfield_approval_comments: sfield_approval_comments,
|
|
3153
3156
|
sfield_settings_panel_title: sfield_settings_panel_title,
|
|
3154
3157
|
sfield_control_advanced: sfield_control_advanced,
|
|
3155
3158
|
sfield_control_general: sfield_control_general,
|
|
@@ -3637,6 +3640,7 @@ var widget_zh = {
|
|
|
3637
3640
|
"steedos-field_type_file": "附件",
|
|
3638
3641
|
"steedos-field_type_formula": "公式",
|
|
3639
3642
|
"steedos-field_type_summary": "累计汇总",
|
|
3643
|
+
"steedos-field_type_approval_comments": "审批意见",
|
|
3640
3644
|
"steedos-field_label": "显示名称",
|
|
3641
3645
|
"steedos-field_api_name": "API 名称",
|
|
3642
3646
|
"steedos-field_api_name_remark": "API 名称只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符",
|
|
@@ -15290,6 +15294,45 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
15290
15294
|
}
|
|
15291
15295
|
};
|
|
15292
15296
|
|
|
15297
|
+
/*
|
|
15298
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15299
|
+
* @Date: 2025-11-04 12:00:23
|
|
15300
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15301
|
+
* @LastEditTime: 2025-11-11 22:01:39
|
|
15302
|
+
*/
|
|
15303
|
+
|
|
15304
|
+
function approvalCommentsToAmis(field, readonly, ctx) {
|
|
15305
|
+
|
|
15306
|
+
let approvalComments = `
|
|
15307
|
+
'<div class="instance-sign-item' + (item.is_finished ? ' mt-1' : ' text-gray-500 border-l-2 px-1 border-blue-500 ' + (item.isMyApprove ? 'my-approve' : '') + ' not-finished') + '">' +
|
|
15308
|
+
'<p class="m-0 p-0">' + (item.isMyApprove ? (instance_my_approve_description || item.description || '') : (item.description || '')) + '</p>' +
|
|
15309
|
+
((item.isMyApprove ? !!(instance_my_approve_description || item.description) : true) ? (item.showApproveSignImage ? item.userSignImage : ('  ' + item.handler_name + ' ')) : '') +
|
|
15310
|
+
(item.finishDateFormated || '') +
|
|
15311
|
+
'</div>'`;
|
|
15312
|
+
let html = `
|
|
15313
|
+
\${JOIN(ARRAYMAP(record.approvalCommentsFields["${field.name}"].comments, item => ${approvalComments}), '') || '  '}
|
|
15314
|
+
`;
|
|
15315
|
+
let approvalCommentsSchema = {
|
|
15316
|
+
"type": "wrapper",
|
|
15317
|
+
"className": "instance-sign",
|
|
15318
|
+
"body": [
|
|
15319
|
+
{
|
|
15320
|
+
"type": "tpl",
|
|
15321
|
+
"tpl": html,
|
|
15322
|
+
"className": "instance-sign-content block m-2.5"
|
|
15323
|
+
},
|
|
15324
|
+
// TODO:签批链接,点击弹出填写签批意见,readonly时不显示签批链接
|
|
15325
|
+
],
|
|
15326
|
+
"size": "none"
|
|
15327
|
+
};
|
|
15328
|
+
let amisSchema = {
|
|
15329
|
+
"type": "control",
|
|
15330
|
+
"label": field.label,
|
|
15331
|
+
"body": [approvalCommentsSchema]
|
|
15332
|
+
};
|
|
15333
|
+
return amisSchema;
|
|
15334
|
+
}
|
|
15335
|
+
|
|
15293
15336
|
const QUICK_SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
|
|
15294
15337
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
15295
15338
|
// const Lookup = require('./lookup');
|
|
@@ -16085,6 +16128,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16085
16128
|
}
|
|
16086
16129
|
}
|
|
16087
16130
|
break;
|
|
16131
|
+
case 'approval_comments':
|
|
16132
|
+
convertData = approvalCommentsToAmis(field);
|
|
16133
|
+
break;
|
|
16088
16134
|
}
|
|
16089
16135
|
if(!___namespace.isEmpty(convertData)){
|
|
16090
16136
|
const className = convertData.className;
|
|
@@ -18722,6 +18768,237 @@ var getDefaultRenderData = function () {
|
|
|
18722
18768
|
};
|
|
18723
18769
|
};
|
|
18724
18770
|
|
|
18771
|
+
/*
|
|
18772
|
+
* @Author: baozhoutao@steedos.com
|
|
18773
|
+
* @Date: 2022-10-08 16:26:26
|
|
18774
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
18775
|
+
* @LastEditTime: 2025-11-11 21:23:23
|
|
18776
|
+
* @Description:
|
|
18777
|
+
*/
|
|
18778
|
+
|
|
18779
|
+
const getTraceApprovesGroupBySteps = (instance, flow) => {
|
|
18780
|
+
if (!instance || !flow) {
|
|
18781
|
+
return {};
|
|
18782
|
+
}
|
|
18783
|
+
|
|
18784
|
+
const steps = flow.steps;
|
|
18785
|
+
const tracesResult = {};
|
|
18786
|
+
|
|
18787
|
+
(instance.traces || []).forEach(trace => {
|
|
18788
|
+
const step = _$1.find(steps, s => s._id === trace.step);
|
|
18789
|
+
const approves = [];
|
|
18790
|
+
|
|
18791
|
+
(trace.approves || []).forEach(approve => {
|
|
18792
|
+
let judge_name = '';
|
|
18793
|
+
if (trace.is_finished === true) {
|
|
18794
|
+
if (approve.judge === 'approved') {
|
|
18795
|
+
judge_name = amisLib.i18next.t("Instance State approved");
|
|
18796
|
+
} else if (approve.judge === 'rejected') {
|
|
18797
|
+
judge_name = amisLib.i18next.t("Instance State rejected");
|
|
18798
|
+
} else if (approve.judge === 'terminated') {
|
|
18799
|
+
judge_name = amisLib.i18next.t("Instance State terminated");
|
|
18800
|
+
} else if (approve.judge === 'reassigned') {
|
|
18801
|
+
judge_name = amisLib.i18next.t("Instance State reassigned");
|
|
18802
|
+
} else if (approve.judge === 'relocated') {
|
|
18803
|
+
judge_name = amisLib.i18next.t("Instance State relocated");
|
|
18804
|
+
} else if (!approve.judge) {
|
|
18805
|
+
judge_name = "";
|
|
18806
|
+
} else {
|
|
18807
|
+
judge_name = "";
|
|
18808
|
+
}
|
|
18809
|
+
} else {
|
|
18810
|
+
judge_name = amisLib.i18next.t("Instance State pending");
|
|
18811
|
+
}
|
|
18812
|
+
|
|
18813
|
+
approves.push({
|
|
18814
|
+
_id: approve._id,
|
|
18815
|
+
handler: approve.user,
|
|
18816
|
+
handler_name: approve.handler_name,
|
|
18817
|
+
handler_organization_name: approve.handler_organization_name,
|
|
18818
|
+
handler_organization_fullname: approve.handler_organization_fullname,
|
|
18819
|
+
finish_date: approve.finish_date,
|
|
18820
|
+
judge: approve.judge,
|
|
18821
|
+
judge_name: judge_name,
|
|
18822
|
+
description: approve.description,
|
|
18823
|
+
is_finished: approve.is_finished,
|
|
18824
|
+
type: approve.type,
|
|
18825
|
+
opinion_fields_code: approve.opinion_fields_code,
|
|
18826
|
+
sign_field_code: approve.sign_field_code,
|
|
18827
|
+
is_read: approve.is_read,
|
|
18828
|
+
sign_show: approve.sign_show
|
|
18829
|
+
});
|
|
18830
|
+
});
|
|
18831
|
+
|
|
18832
|
+
if (step) {
|
|
18833
|
+
if (tracesResult.hasOwnProperty(step.name)) {
|
|
18834
|
+
tracesResult[step.name] = tracesResult[step.name].concat(approves);
|
|
18835
|
+
} else {
|
|
18836
|
+
tracesResult[step.name] = approves;
|
|
18837
|
+
}
|
|
18838
|
+
}
|
|
18839
|
+
});
|
|
18840
|
+
|
|
18841
|
+
return tracesResult;
|
|
18842
|
+
};
|
|
18843
|
+
|
|
18844
|
+
const getTraceApprovesByStep = (instance, flow, stepName, only_cc_opinion) => {
|
|
18845
|
+
if (!instance) return [];
|
|
18846
|
+
|
|
18847
|
+
const is_completed = instance?.state === "completed";
|
|
18848
|
+
let completed_date = 0;
|
|
18849
|
+
if (is_completed) {
|
|
18850
|
+
let lastTrace = _$1.last(instance.traces);
|
|
18851
|
+
completed_date = lastTrace && lastTrace.finish_date ? (new Date(lastTrace.finish_date)).getTime() : 0;
|
|
18852
|
+
}
|
|
18853
|
+
if (is_completed && instance.finish_date) {
|
|
18854
|
+
completed_date = (new Date(instance.finish_date)).getTime();
|
|
18855
|
+
}
|
|
18856
|
+
|
|
18857
|
+
const tracesObj = getTraceApprovesGroupBySteps(instance, flow);
|
|
18858
|
+
|
|
18859
|
+
let approves = _$1.clone(tracesObj[stepName] || []);
|
|
18860
|
+
|
|
18861
|
+
const approve_sort = approvesParam => {
|
|
18862
|
+
return _$1.sortBy(approvesParam, approve => {
|
|
18863
|
+
let date = approve.finish_date ? new Date(approve.finish_date) : new Date();
|
|
18864
|
+
return -date.getTime();
|
|
18865
|
+
}) || [];
|
|
18866
|
+
};
|
|
18867
|
+
|
|
18868
|
+
approves = _$1.filter(approves, a => a.type !== "forward" && a.type !== "distribute" && a.type !== "terminated");
|
|
18869
|
+
|
|
18870
|
+
if (only_cc_opinion) {
|
|
18871
|
+
approves = _$1.filter(approves, a => a.type === "cc");
|
|
18872
|
+
}
|
|
18873
|
+
|
|
18874
|
+
let approves_sorted = approve_sort(approves);
|
|
18875
|
+
|
|
18876
|
+
const approvesGroup = _$1.groupBy(approves, "handler");
|
|
18877
|
+
|
|
18878
|
+
function hasNext(approve, group) {
|
|
18879
|
+
const handlerApproves = group[approve.handler];
|
|
18880
|
+
return _$1.indexOf(handlerApproves, approve) + 1 < handlerApproves.length;
|
|
18881
|
+
}
|
|
18882
|
+
|
|
18883
|
+
approves_sorted.forEach(approve => {
|
|
18884
|
+
// showBlank为false时,签字字段上配置的默认意见不会生效
|
|
18885
|
+
const showBlank = true;//Meteor.settings.public.workflow?.showBlankApproveDescription;
|
|
18886
|
+
if (
|
|
18887
|
+
approve.sign_show !== false
|
|
18888
|
+
&& (approve.description
|
|
18889
|
+
|| (!approve.description && !hasNext(approve, approvesGroup) && !approve.is_finished)
|
|
18890
|
+
|| showBlank
|
|
18891
|
+
)
|
|
18892
|
+
&& approve.judge !== 'terminated'
|
|
18893
|
+
) {
|
|
18894
|
+
approve._display = true;
|
|
18895
|
+
}
|
|
18896
|
+
});
|
|
18897
|
+
|
|
18898
|
+
approves_sorted = _$1.filter(approves_sorted, a => {
|
|
18899
|
+
if (is_completed) {
|
|
18900
|
+
return a._display === true && a.is_finished && a.finish_date && (new Date(a.finish_date)).getTime() <= completed_date;
|
|
18901
|
+
} else {
|
|
18902
|
+
return a._display === true;
|
|
18903
|
+
}
|
|
18904
|
+
});
|
|
18905
|
+
|
|
18906
|
+
return approves_sorted;
|
|
18907
|
+
};
|
|
18908
|
+
|
|
18909
|
+
const isOpinionOfField = (approve, field) => {
|
|
18910
|
+
if (approve.type === "cc" && field.name) {
|
|
18911
|
+
return field.name === approve.sign_field_code;
|
|
18912
|
+
} else {
|
|
18913
|
+
return true;
|
|
18914
|
+
}
|
|
18915
|
+
};
|
|
18916
|
+
|
|
18917
|
+
const isMyApprove = ({ approve, only_cc_opinion, box, currentApprove, field }) => {
|
|
18918
|
+
if (box !== 'inbox') {
|
|
18919
|
+
return false;
|
|
18920
|
+
}
|
|
18921
|
+
|
|
18922
|
+
if (!approve?._id) {
|
|
18923
|
+
approve = currentApprove;
|
|
18924
|
+
}
|
|
18925
|
+
|
|
18926
|
+
if (
|
|
18927
|
+
approve._id === currentApprove?._id &&
|
|
18928
|
+
currentApprove?.type === 'cc' &&
|
|
18929
|
+
field.name
|
|
18930
|
+
) {
|
|
18931
|
+
return ___default["default"].indexOf(currentApprove?.opinion_fields_code, field.name) > -1;
|
|
18932
|
+
}
|
|
18933
|
+
|
|
18934
|
+
if (!(currentApprove?.type === 'cc') && only_cc_opinion) {
|
|
18935
|
+
return false;
|
|
18936
|
+
}
|
|
18937
|
+
|
|
18938
|
+
if (currentApprove && approve._id === currentApprove._id) {
|
|
18939
|
+
return true;
|
|
18940
|
+
}
|
|
18941
|
+
|
|
18942
|
+
return false;
|
|
18943
|
+
};
|
|
18944
|
+
|
|
18945
|
+
const showApprove = (approve, field) => {
|
|
18946
|
+
if (!approve.sign_field_code || approve.sign_field_code === field.name) {
|
|
18947
|
+
if (approve?.is_read) {
|
|
18948
|
+
if (approve.is_finished) {
|
|
18949
|
+
return ["approved", "rejected", "submitted", "readed"].includes(approve.judge);
|
|
18950
|
+
}
|
|
18951
|
+
}
|
|
18952
|
+
}
|
|
18953
|
+
return false;
|
|
18954
|
+
};
|
|
18955
|
+
|
|
18956
|
+
const isReaded = (judge) => {
|
|
18957
|
+
return ["approved", "rejected", "submitted", "readed"].includes(judge);
|
|
18958
|
+
};
|
|
18959
|
+
|
|
18960
|
+
const showApproveDefaultDescription = (approve) => {
|
|
18961
|
+
if (approve.is_finished && isReaded(approve.judge)) {
|
|
18962
|
+
return true;
|
|
18963
|
+
}
|
|
18964
|
+
return false;
|
|
18965
|
+
};
|
|
18966
|
+
|
|
18967
|
+
const showApproveSignImage = (judge) => {
|
|
18968
|
+
return !['returned', 'terminated', 'retrieved'].includes(judge);
|
|
18969
|
+
};
|
|
18970
|
+
|
|
18971
|
+
const getUserApprove = ({ instance, userId }) => {
|
|
18972
|
+
const currentTrace = _$1.find(instance.traces, (trace) => {
|
|
18973
|
+
return trace.is_finished != true;
|
|
18974
|
+
});
|
|
18975
|
+
let currentApprove = null;
|
|
18976
|
+
if (currentTrace) {
|
|
18977
|
+
currentApprove = _$1.find(currentTrace.approves, (approve) => {
|
|
18978
|
+
return approve.is_finished != true && approve.handler == userId;
|
|
18979
|
+
});
|
|
18980
|
+
}
|
|
18981
|
+
|
|
18982
|
+
//传阅的approve返回最新一条
|
|
18983
|
+
if (!currentApprove || currentApprove.type == "cc") {
|
|
18984
|
+
// 当前是传阅
|
|
18985
|
+
___default["default"].each(instance.traces, function (t) {
|
|
18986
|
+
___default["default"].each(t.approves, function (a) {
|
|
18987
|
+
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
18988
|
+
currentApprove = a;
|
|
18989
|
+
}
|
|
18990
|
+
});
|
|
18991
|
+
});
|
|
18992
|
+
}
|
|
18993
|
+
|
|
18994
|
+
if (!currentApprove) return;
|
|
18995
|
+
|
|
18996
|
+
if (currentApprove._id) {
|
|
18997
|
+
currentApprove.id = currentApprove._id;
|
|
18998
|
+
}
|
|
18999
|
+
return currentApprove;
|
|
19000
|
+
};
|
|
19001
|
+
|
|
18725
19002
|
//TODO Meteor.settings.public?.workflow?.hideCounterSignJudgeOptions
|
|
18726
19003
|
|
|
18727
19004
|
const HIDE_COUNTER_SIGN_JUDGE_OPTIONS = false;
|
|
@@ -19290,6 +19567,8 @@ const getSubmitActions = async (instance, submitEvents) => {
|
|
|
19290
19567
|
};
|
|
19291
19568
|
|
|
19292
19569
|
const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
19570
|
+
const userId = amisLib.getSteedosAuth().userId;
|
|
19571
|
+
const userApprove = getUserApprove({ instance, userId });
|
|
19293
19572
|
return {
|
|
19294
19573
|
type: "drawer",
|
|
19295
19574
|
overlay: false,
|
|
@@ -19327,7 +19606,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19327
19606
|
minRows: 3,
|
|
19328
19607
|
maxRows: 20,
|
|
19329
19608
|
placeholder: amisLib.i18next.t('frontend_workflow_suggestion_placeholder'),//"请填写意见",
|
|
19330
|
-
requiredOn: "${judge === 'rejected'}"
|
|
19609
|
+
requiredOn: "${judge === 'rejected'}",
|
|
19610
|
+
value: userApprove?.description,
|
|
19611
|
+
"onEvent": {
|
|
19612
|
+
"change": {
|
|
19613
|
+
"actions": [
|
|
19614
|
+
{
|
|
19615
|
+
"componentId": "u:instancePage",
|
|
19616
|
+
"actionType": "setValue",
|
|
19617
|
+
"args": {
|
|
19618
|
+
"value": {
|
|
19619
|
+
"instance_my_approve_description": "${value}"
|
|
19620
|
+
}
|
|
19621
|
+
}
|
|
19622
|
+
}
|
|
19623
|
+
]
|
|
19624
|
+
}
|
|
19625
|
+
}
|
|
19331
19626
|
},
|
|
19332
19627
|
await getNextStepInput(instance),
|
|
19333
19628
|
await getNextStepUsersInput(instance),
|
|
@@ -19353,23 +19648,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19353
19648
|
// }
|
|
19354
19649
|
// ]
|
|
19355
19650
|
// },
|
|
19356
|
-
validateError: {
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
}
|
|
19651
|
+
// validateError: {
|
|
19652
|
+
// weight: 0,
|
|
19653
|
+
// actions: [
|
|
19654
|
+
// {
|
|
19655
|
+
// "componentId": "",
|
|
19656
|
+
// "args": {
|
|
19657
|
+
// "msgType": "info",
|
|
19658
|
+
// "position": "top-right",
|
|
19659
|
+
// "closeButton": true,
|
|
19660
|
+
// "showIcon": true,
|
|
19661
|
+
// "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
19662
|
+
// "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
|
|
19663
|
+
// },
|
|
19664
|
+
// "actionType": "toast"
|
|
19665
|
+
// }
|
|
19666
|
+
// ],
|
|
19667
|
+
// }
|
|
19373
19668
|
},
|
|
19374
19669
|
|
|
19375
19670
|
},
|
|
@@ -19604,7 +19899,7 @@ const getRelatedInstances = async (instance)=>{
|
|
|
19604
19899
|
* @Author: baozhoutao@steedos.com
|
|
19605
19900
|
* @Date: 2022-09-24 16:48:28
|
|
19606
19901
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
19607
|
-
* @LastEditTime: 2025-
|
|
19902
|
+
* @LastEditTime: 2025-11-03 11:16:43
|
|
19608
19903
|
* @Description:
|
|
19609
19904
|
*/
|
|
19610
19905
|
|
|
@@ -19628,19 +19923,19 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
19628
19923
|
"name": "user_name",
|
|
19629
19924
|
"label": "user_name",
|
|
19630
19925
|
"type": "tpl",
|
|
19631
|
-
"tpl": "<div><div>${opinion}</div>${user_name}</div>"
|
|
19926
|
+
"tpl": "<div><div>${opinion}</div>${user_name|raw}</div>"
|
|
19632
19927
|
},
|
|
19633
19928
|
{
|
|
19634
19929
|
"name": "finish_date",
|
|
19635
19930
|
"label": "finish_date",
|
|
19636
|
-
"classNameExpr":
|
|
19931
|
+
"classNameExpr": `<%= data.finish_date == '${amisLib.i18next.t('frontend_workflow_approval_history_read')}' ? 'text-[blue]' : (data.finish_date == '${amisLib.i18next.t('frontend_workflow_approval_history_unprocessed')}' ? 'text-[red]' : '') %>`
|
|
19637
19932
|
// "type": "datetime",
|
|
19638
19933
|
// "format": "YYYY-MM-DD HH:mm"
|
|
19639
19934
|
},
|
|
19640
19935
|
{
|
|
19641
19936
|
"name": "judge",
|
|
19642
19937
|
"label": "judge",
|
|
19643
|
-
"classNameExpr":
|
|
19938
|
+
"classNameExpr": `<%= data.judge == '${amisLib.i18next.t('frontend_workflow_approval_judge_approved')}' ? 'text-green-600' : (data.judge == '${amisLib.i18next.t('frontend_workflow_approval_judge_rejected')}' ? 'text-[red]' : '') %>`
|
|
19644
19939
|
}
|
|
19645
19940
|
]
|
|
19646
19941
|
}
|
|
@@ -19650,7 +19945,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
19650
19945
|
* @Author: baozhoutao@steedos.com
|
|
19651
19946
|
* @Date: 2022-09-07 16:20:45
|
|
19652
19947
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
19653
|
-
* @LastEditTime: 2025-
|
|
19948
|
+
* @LastEditTime: 2025-10-30 13:40:31
|
|
19654
19949
|
* @Description:
|
|
19655
19950
|
*/
|
|
19656
19951
|
|
|
@@ -19668,7 +19963,7 @@ const getSelectOptions = (field) => {
|
|
|
19668
19963
|
return options;
|
|
19669
19964
|
};
|
|
19670
19965
|
|
|
19671
|
-
const isOpinionField
|
|
19966
|
+
const isOpinionField = (field)=>{
|
|
19672
19967
|
const field_formula = field.formula;
|
|
19673
19968
|
return (field_formula?.indexOf("{traces.") > -1 || field_formula?.indexOf("{signature.traces.") > -1 || field_formula?.indexOf("{yijianlan:") > -1 || field_formula?.indexOf("{\"yijianlan\":") > -1 || field_formula?.indexOf("{'yijianlan':") > -1)
|
|
19674
19969
|
};
|
|
@@ -19682,7 +19977,7 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
19682
19977
|
disabled: field.permission !== "editable",
|
|
19683
19978
|
required: field.is_required
|
|
19684
19979
|
};
|
|
19685
|
-
if(isOpinionField
|
|
19980
|
+
if(isOpinionField(field)){
|
|
19686
19981
|
tpl.type = 'input-group';
|
|
19687
19982
|
tpl.body = [
|
|
19688
19983
|
{
|
|
@@ -20480,11 +20775,54 @@ const getApproveButton = async (instance, submitEvents)=>{
|
|
|
20480
20775
|
},
|
|
20481
20776
|
id: "steedos-approve-button",
|
|
20482
20777
|
level: "primary",
|
|
20483
|
-
className:
|
|
20484
|
-
"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0",
|
|
20778
|
+
className: {
|
|
20779
|
+
"approve-button w-14 h-14 rounded-full fixed bottom-4 right-4 shadow-lg text-white text-base text-center font-semibold bg-blue-500 p-0": true,
|
|
20780
|
+
"hidden": instance.box === 'draft'
|
|
20781
|
+
}
|
|
20485
20782
|
}
|
|
20486
20783
|
};
|
|
20487
20784
|
|
|
20785
|
+
const getScrollToBottomAutoOpenApproveDrawerScript = () => {
|
|
20786
|
+
return `
|
|
20787
|
+
(function () {
|
|
20788
|
+
setTimeout(function () {
|
|
20789
|
+
var bodyEl = document.querySelector('.steedos-amis-instance-view-body');
|
|
20790
|
+
if (!bodyEl) return;
|
|
20791
|
+
var btn = document.querySelector('.approve-button');
|
|
20792
|
+
if (!btn) return;
|
|
20793
|
+
|
|
20794
|
+
var lastAtBottom = false; // 上一个scroll事件是否到底
|
|
20795
|
+
|
|
20796
|
+
function isAtBottom() {
|
|
20797
|
+
var scrollTop = bodyEl.scrollTop,
|
|
20798
|
+
scrollHeight = bodyEl.scrollHeight,
|
|
20799
|
+
clientHeight = bodyEl.clientHeight;
|
|
20800
|
+
return (scrollHeight <= clientHeight) || (scrollTop + clientHeight >= scrollHeight - 2);
|
|
20801
|
+
}
|
|
20802
|
+
|
|
20803
|
+
// wheel: 只要现在到底、且是向下滚,即可弹出
|
|
20804
|
+
bodyEl.addEventListener('wheel', function (e) {
|
|
20805
|
+
var atBottom = isAtBottom();
|
|
20806
|
+
if (atBottom && e.deltaY > 0) {
|
|
20807
|
+
// [wheel] 拖动条在底部且向下滚,弹drawer
|
|
20808
|
+
btn.click();
|
|
20809
|
+
}
|
|
20810
|
+
});
|
|
20811
|
+
|
|
20812
|
+
// scroll: 拖动时仅“从非底部->底部”瞬间弹
|
|
20813
|
+
bodyEl.addEventListener('scroll', function () {
|
|
20814
|
+
var atBottom = isAtBottom();
|
|
20815
|
+
if (!lastAtBottom && atBottom) {
|
|
20816
|
+
// [scroll] 拖动条到底,弹drawer
|
|
20817
|
+
btn.click();
|
|
20818
|
+
}
|
|
20819
|
+
lastAtBottom = atBottom;
|
|
20820
|
+
});
|
|
20821
|
+
}, 1000);
|
|
20822
|
+
})();
|
|
20823
|
+
`;
|
|
20824
|
+
};
|
|
20825
|
+
|
|
20488
20826
|
const getFlowFormSchema = async (instance, box) => {
|
|
20489
20827
|
const formStyle = instance.form.current.style || "table";
|
|
20490
20828
|
let formContentSchema;
|
|
@@ -20507,6 +20845,14 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20507
20845
|
changeEvents = onEvent?.change.actions || [];
|
|
20508
20846
|
submitEvents = onEvent?.submit.actions || [];
|
|
20509
20847
|
}
|
|
20848
|
+
if (box == 'inbox' || box == 'draft') {
|
|
20849
|
+
// 滚动条滚动到底部弹出底部签批drawer窗口
|
|
20850
|
+
initedEvents.push({
|
|
20851
|
+
"actionType": "custom",
|
|
20852
|
+
"script": getScrollToBottomAutoOpenApproveDrawerScript(),
|
|
20853
|
+
"args": {}
|
|
20854
|
+
});
|
|
20855
|
+
}
|
|
20510
20856
|
|
|
20511
20857
|
console.log('getFlowFormSchema formContentSchema', formContentSchema);
|
|
20512
20858
|
return {
|
|
@@ -20588,23 +20934,23 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20588
20934
|
],
|
|
20589
20935
|
id: "instance_form",
|
|
20590
20936
|
onEvent: {
|
|
20591
|
-
validateError: {
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
20595
|
-
|
|
20596
|
-
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
|
|
20606
|
-
|
|
20607
|
-
},
|
|
20937
|
+
// validateError: {
|
|
20938
|
+
// weight: 0,
|
|
20939
|
+
// actions: [
|
|
20940
|
+
// {
|
|
20941
|
+
// "componentId": "",
|
|
20942
|
+
// "args": {
|
|
20943
|
+
// "msgType": "info",
|
|
20944
|
+
// "position": "top-right",
|
|
20945
|
+
// "closeButton": true,
|
|
20946
|
+
// "showIcon": true,
|
|
20947
|
+
// "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
|
|
20948
|
+
// "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
|
|
20949
|
+
// },
|
|
20950
|
+
// "actionType": "toast"
|
|
20951
|
+
// }
|
|
20952
|
+
// ],
|
|
20953
|
+
// },
|
|
20608
20954
|
change: {
|
|
20609
20955
|
weight: 0,
|
|
20610
20956
|
actions: [
|
|
@@ -20693,83 +21039,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20693
21039
|
};
|
|
20694
21040
|
};
|
|
20695
21041
|
|
|
20696
|
-
/*
|
|
20697
|
-
* @Author: baozhoutao@steedos.com
|
|
20698
|
-
* @Date: 2022-10-08 16:26:26
|
|
20699
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
20700
|
-
* @LastEditTime: 2022-10-08 16:28:42
|
|
20701
|
-
* @Description:
|
|
20702
|
-
*/
|
|
20703
|
-
|
|
20704
|
-
const isOpinionField = (field_formula)=>{
|
|
20705
|
-
return (field_formula?.indexOf("{traces.") > -1 || field_formula?.indexOf("{signature.traces.") > -1 || field_formula?.indexOf("{yijianlan:") > -1 || field_formula?.indexOf("{\"yijianlan\":") > -1 || field_formula?.indexOf("{'yijianlan':") > -1)
|
|
20706
|
-
};
|
|
20707
|
-
|
|
20708
|
-
const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
20709
|
-
const field_formula = field.formula;
|
|
20710
|
-
var foo1, opinionFields;
|
|
20711
|
-
opinionFields = new Array();
|
|
20712
|
-
if (isOpinionField(field_formula)) {
|
|
20713
|
-
if (field_formula) {
|
|
20714
|
-
foo1 = field_formula.split(";");
|
|
20715
|
-
foo1.forEach(function(foo) {
|
|
20716
|
-
var json_formula, s1, sf, _ref, _ref1;
|
|
20717
|
-
json_formula = {};
|
|
20718
|
-
try {
|
|
20719
|
-
json_formula = eval("(" + foo + ")");
|
|
20720
|
-
} catch (_error) {
|
|
20721
|
-
json_formula = {};
|
|
20722
|
-
}
|
|
20723
|
-
if (json_formula != null ? json_formula.yijianlan : void 0) {
|
|
20724
|
-
sf = {};
|
|
20725
|
-
sf.stepName = json_formula.yijianlan.step;
|
|
20726
|
-
sf.image_sign = json_formula.yijianlan.image_sign || false;
|
|
20727
|
-
sf.only_cc_opinion = json_formula.yijianlan.only_cc || false;
|
|
20728
|
-
sf.default_description = json_formula.yijianlan["default"];
|
|
20729
|
-
sf.only_handler = json_formula.yijianlan.only_handler;
|
|
20730
|
-
sf.top_keywords = json_formula.yijianlan.top_keywords || top_keywords;
|
|
20731
|
-
return opinionFields.push(sf);
|
|
20732
|
-
} else if ((field_formula != null ? field_formula.indexOf("{traces.") : void 0) > -1 || (field_formula != null ? field_formula.indexOf("{signature.traces.") : void 0) > -1) {
|
|
20733
|
-
sf = {
|
|
20734
|
-
only_cc_opinion: false,
|
|
20735
|
-
image_sign: false,
|
|
20736
|
-
top_keywords: top_keywords
|
|
20737
|
-
};
|
|
20738
|
-
if (foo.indexOf("{signature.") > -1) {
|
|
20739
|
-
sf.image_sign = true;
|
|
20740
|
-
foo = foo.replace("{signature.", "");
|
|
20741
|
-
}
|
|
20742
|
-
s1 = foo.replace("{", "").replace("}", "");
|
|
20743
|
-
if (s1.split(".").length > 1) {
|
|
20744
|
-
sf.stepName = s1.split(".")[1];
|
|
20745
|
-
if (opinionFields.filterProperty("stepName", sf.stepName).length > 0) {
|
|
20746
|
-
if ((_ref = opinionFields.findPropertyByPK("stepName", sf.stepName)) != null) {
|
|
20747
|
-
_ref.only_cc_opinion = true;
|
|
20748
|
-
}
|
|
20749
|
-
} else {
|
|
20750
|
-
if (s1.split(".").length > 2) {
|
|
20751
|
-
if (((_ref1 = s1.split(".")[2]) != null ? _ref1.toLocaleLowerCase() : void 0) === 'cc') {
|
|
20752
|
-
sf.only_cc_opinion = true;
|
|
20753
|
-
}
|
|
20754
|
-
}
|
|
20755
|
-
}
|
|
20756
|
-
}
|
|
20757
|
-
return opinionFields.push(sf);
|
|
20758
|
-
}
|
|
20759
|
-
});
|
|
20760
|
-
}
|
|
20761
|
-
}
|
|
20762
|
-
return opinionFields;
|
|
20763
|
-
};
|
|
20764
|
-
|
|
20765
|
-
/*
|
|
20766
|
-
* @Author: baozhoutao@steedos.com
|
|
20767
|
-
* @Date: 2022-09-09 17:47:37
|
|
20768
|
-
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20769
|
-
* @LastEditTime: 2025-09-01 23:33:14
|
|
20770
|
-
* @Description:
|
|
20771
|
-
*/
|
|
20772
|
-
|
|
20773
21042
|
const getMoment = ()=>{
|
|
20774
21043
|
if(window.amisRequire){
|
|
20775
21044
|
return window.amisRequire("moment");
|
|
@@ -20784,37 +21053,6 @@ const getTrace = ({ instance, traceId }) => {
|
|
|
20784
21053
|
});
|
|
20785
21054
|
};
|
|
20786
21055
|
|
|
20787
|
-
const getUserApprove = ({ instance, userId }) => {
|
|
20788
|
-
const currentTrace = _$1.find(instance.traces, (trace) => {
|
|
20789
|
-
return trace.is_finished != true;
|
|
20790
|
-
});
|
|
20791
|
-
let currentApprove = null;
|
|
20792
|
-
if (currentTrace) {
|
|
20793
|
-
currentApprove = _$1.find(currentTrace.approves, (approve) => {
|
|
20794
|
-
return approve.is_finished != true && approve.handler == userId;
|
|
20795
|
-
});
|
|
20796
|
-
}
|
|
20797
|
-
|
|
20798
|
-
//传阅的approve返回最新一条
|
|
20799
|
-
if (!currentApprove || currentApprove.type == "cc") {
|
|
20800
|
-
// 当前是传阅
|
|
20801
|
-
___default["default"].each(instance.traces, function (t) {
|
|
20802
|
-
___default["default"].each(t.approves, function (a) {
|
|
20803
|
-
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
20804
|
-
currentApprove = a;
|
|
20805
|
-
}
|
|
20806
|
-
});
|
|
20807
|
-
});
|
|
20808
|
-
}
|
|
20809
|
-
|
|
20810
|
-
if (!currentApprove) return;
|
|
20811
|
-
|
|
20812
|
-
if (currentApprove._id) {
|
|
20813
|
-
currentApprove.id = currentApprove._id;
|
|
20814
|
-
}
|
|
20815
|
-
return currentApprove;
|
|
20816
|
-
};
|
|
20817
|
-
|
|
20818
21056
|
const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
20819
21057
|
let instanceValues = null;
|
|
20820
21058
|
if (!approve || approve.type === "cc") {
|
|
@@ -20911,10 +21149,26 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
20911
21149
|
return step_id;
|
|
20912
21150
|
};
|
|
20913
21151
|
|
|
20914
|
-
const
|
|
20915
|
-
|
|
21152
|
+
const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
|
|
21153
|
+
if (traceShowSignImage === false) {
|
|
21154
|
+
return false;
|
|
21155
|
+
}
|
|
21156
|
+
if (!is_finished) {
|
|
21157
|
+
return false;
|
|
21158
|
+
}
|
|
21159
|
+
if (['returned', 'terminated', 'retrieved'].includes(judge)) {
|
|
21160
|
+
return false;
|
|
21161
|
+
}
|
|
21162
|
+
return true;
|
|
20916
21163
|
};
|
|
20917
21164
|
|
|
21165
|
+
const getSpaceUserSign = async (space, handler) => {
|
|
21166
|
+
const result = await amisLib.fetchAPI(`/api/v1/space_user_signs?filters=[["space","=","${space}"],["user","=","${handler}"]]&fields=["sign"]`);
|
|
21167
|
+
if (result?.data?.items && result.data.items.length > 0) {
|
|
21168
|
+
return result.data.items[0].sign;
|
|
21169
|
+
}
|
|
21170
|
+
return null;
|
|
21171
|
+
};
|
|
20918
21172
|
|
|
20919
21173
|
const getInstanceInfo = async (props) => {
|
|
20920
21174
|
const { instanceId, box } = props;
|
|
@@ -20967,7 +21221,7 @@ const getInstanceInfo = async (props) => {
|
|
|
20967
21221
|
}),
|
|
20968
21222
|
});
|
|
20969
21223
|
|
|
20970
|
-
|
|
21224
|
+
const moment = getMoment();
|
|
20971
21225
|
let userApprove = null;
|
|
20972
21226
|
let trace = null;
|
|
20973
21227
|
let step = null;
|
|
@@ -21002,7 +21256,77 @@ const getInstanceInfo = async (props) => {
|
|
|
21002
21256
|
method: "get",
|
|
21003
21257
|
});
|
|
21004
21258
|
|
|
21005
|
-
const
|
|
21259
|
+
const signImageCache = new Map();
|
|
21260
|
+
const approvalCommentsFields = {};
|
|
21261
|
+
___default["default"].each(formVersion.fields, (field) => {
|
|
21262
|
+
if (field.config?.type === "approval_comments") {
|
|
21263
|
+
approvalCommentsFields[field.code] = ___default["default"].clone(field.config);
|
|
21264
|
+
}
|
|
21265
|
+
if (field.type === 'section') {
|
|
21266
|
+
___default["default"].each(field.fields, (subField) => {
|
|
21267
|
+
if (subField.config?.type === "approval_comments") {
|
|
21268
|
+
approvalCommentsFields[subField.code] = ___default["default"].clone(subField.config);
|
|
21269
|
+
}
|
|
21270
|
+
});
|
|
21271
|
+
}
|
|
21272
|
+
});
|
|
21273
|
+
const myApproveFields = [];
|
|
21274
|
+
for (const field of ___default["default"].values(approvalCommentsFields)) {
|
|
21275
|
+
const fieldSteps = ___default["default"].clone(field.steps);
|
|
21276
|
+
if (fieldSteps && fieldSteps.length > 0) {
|
|
21277
|
+
let fieldComments = [];
|
|
21278
|
+
for (const fieldStep of fieldSteps) {
|
|
21279
|
+
const only_cc_opinion = fieldStep.show_cc && !fieldStep.show_handler;
|
|
21280
|
+
const stepApproves = getTraceApprovesByStep(instance, flowVersion, fieldStep.name, only_cc_opinion);
|
|
21281
|
+
for (const approve of stepApproves) {
|
|
21282
|
+
let userName = approve.user_name;
|
|
21283
|
+
approve.isOpinionOfField = isOpinionOfField(approve, field);
|
|
21284
|
+
if (approve.isOpinionOfField) {
|
|
21285
|
+
approve.isMyApprove = isMyApprove({ approve, only_cc_opinion, box, currentApprove: userApprove, field });
|
|
21286
|
+
if (approve.isMyApprove) {
|
|
21287
|
+
myApproveFields.push(field);
|
|
21288
|
+
}
|
|
21289
|
+
approve.showApprove = showApprove(approve, field);
|
|
21290
|
+
if (approve.showApprove && !approve.description && fieldStep.default && showApproveDefaultDescription(approve)) {
|
|
21291
|
+
approve.description = fieldStep.default;
|
|
21292
|
+
}
|
|
21293
|
+
if (approve.description){
|
|
21294
|
+
approve.description = approve.description.replace(/\n/g, "<br/>");
|
|
21295
|
+
}
|
|
21296
|
+
if (moment && approve.finish_date){
|
|
21297
|
+
approve.finishDateFormated = moment(approve.finish_date).format("YYYY-MM-DD");
|
|
21298
|
+
}
|
|
21299
|
+
let showSignImage = fieldStep.show_image_sign && showApproveSignImage(approve.judge);
|
|
21300
|
+
if (showSignImage){
|
|
21301
|
+
let userSign, userSignImage;
|
|
21302
|
+
if (signImageCache.has(approve.handler)) {
|
|
21303
|
+
userSign = signImageCache.get(approve.handler);
|
|
21304
|
+
} else {
|
|
21305
|
+
userSign = await getSpaceUserSign(instance.space, approve.handler);
|
|
21306
|
+
signImageCache.set(approve.handler, userSign);
|
|
21307
|
+
}
|
|
21308
|
+
if (userSign){
|
|
21309
|
+
userSignImage = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
|
|
21310
|
+
}
|
|
21311
|
+
approve.showApproveSignImage = !!userSign;
|
|
21312
|
+
approve.userSignImage = userSignImage;
|
|
21313
|
+
}
|
|
21314
|
+
}
|
|
21315
|
+
} fieldComments = ___default["default"].union(fieldComments, stepApproves);
|
|
21316
|
+
} field.comments = fieldComments.filter((comment) => {
|
|
21317
|
+
return comment.isOpinionOfField && (comment.isMyApprove || (comment.showApprove && !!comment.description));
|
|
21318
|
+
});
|
|
21319
|
+
}
|
|
21320
|
+
}
|
|
21321
|
+
if (step?.permissions) {
|
|
21322
|
+
// 字段字段
|
|
21323
|
+
___default["default"].each(approvalCommentsFields, (field) => {
|
|
21324
|
+
delete step.permissions[field.name];
|
|
21325
|
+
if (___default["default"].find(myApproveFields, { name: field.name })) {
|
|
21326
|
+
step.permissions[field.name] = 'editable';
|
|
21327
|
+
}
|
|
21328
|
+
});
|
|
21329
|
+
}
|
|
21006
21330
|
return {
|
|
21007
21331
|
box: box,
|
|
21008
21332
|
_id: instanceId,
|
|
@@ -21021,12 +21345,14 @@ const getInstanceInfo = async (props) => {
|
|
|
21021
21345
|
name: instance.name || instance.form.name,
|
|
21022
21346
|
fields: ___default["default"].map(formVersion.fields, (field) => {
|
|
21023
21347
|
const newField = Object.assign({}, field, {
|
|
21024
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21348
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21349
|
+
permission: userApprove?.type != 'cc' && step?.permissions[field.code],
|
|
21025
21350
|
}) ;
|
|
21026
21351
|
if(field.type === 'section'){
|
|
21027
21352
|
newField.fields = ___default["default"].map(field.fields, (sfield) => {
|
|
21028
21353
|
return Object.assign({}, sfield, {
|
|
21029
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21354
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21355
|
+
permission: userApprove?.type != 'cc' && step?.permissions[sfield.code],
|
|
21030
21356
|
type: sfield._type || sfield.type
|
|
21031
21357
|
});
|
|
21032
21358
|
});
|
|
@@ -21046,14 +21372,28 @@ const getInstanceInfo = async (props) => {
|
|
|
21046
21372
|
forward_from_instance: instance.forward_from_instance,
|
|
21047
21373
|
cc_users: instance.cc_users,
|
|
21048
21374
|
traces: instance.traces,
|
|
21049
|
-
historyApproves: ___default["default"].map(instance.traces, (trace) => {
|
|
21375
|
+
historyApproves: await Promise.all(___default["default"].map(instance.traces, async (trace) => {
|
|
21050
21376
|
return Object.assign(
|
|
21051
21377
|
{
|
|
21052
|
-
children: ___default["default"].map(trace.approves, (approve) => {
|
|
21378
|
+
children: await Promise.all(___default["default"].map(trace.approves, async (approve) => {
|
|
21053
21379
|
let finishDate = approve.finish_date;
|
|
21054
21380
|
let judge = approve.judge;
|
|
21055
21381
|
let userName = approve.user_name;
|
|
21056
21382
|
let opinion = approve.description;
|
|
21383
|
+
const traceShowSignImage = true;
|
|
21384
|
+
let showSignImage = isNeedToShowSignImage(approve.is_finished, approve.judge, traceShowSignImage);
|
|
21385
|
+
let userSign;
|
|
21386
|
+
if (showSignImage) {
|
|
21387
|
+
if (signImageCache.has(approve.handler)) {
|
|
21388
|
+
userSign = signImageCache.get(approve.handler);
|
|
21389
|
+
} else {
|
|
21390
|
+
userSign = await getSpaceUserSign(instance.space, approve.handler);
|
|
21391
|
+
signImageCache.set(approve.handler, userSign);
|
|
21392
|
+
}
|
|
21393
|
+
if (userSign){
|
|
21394
|
+
userName = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
|
|
21395
|
+
}
|
|
21396
|
+
}
|
|
21057
21397
|
if(approve.type === 'cc'){
|
|
21058
21398
|
userName = `${userName} (传阅)`;
|
|
21059
21399
|
opinion = approve.cc_description;
|
|
@@ -21107,11 +21447,12 @@ const getInstanceInfo = async (props) => {
|
|
|
21107
21447
|
judge: judge,
|
|
21108
21448
|
opinion: opinion,
|
|
21109
21449
|
};
|
|
21110
|
-
}),
|
|
21450
|
+
})),
|
|
21111
21451
|
},
|
|
21112
21452
|
{ name: trace.name, judge: "" }
|
|
21113
21453
|
);
|
|
21114
|
-
}),
|
|
21454
|
+
})),
|
|
21455
|
+
approvalCommentsFields
|
|
21115
21456
|
};
|
|
21116
21457
|
};
|
|
21117
21458
|
|