@steedos-widgets/amis-lib 6.10.4 → 6.10.6
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 +382 -123
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +383 -124
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +125 -120
- 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 -0
- package/dist/types/workflow/flow.d.ts +16 -0
- 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 名称只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符",
|
|
@@ -5819,10 +5823,14 @@ function getBatchDelete(objectName){
|
|
|
5819
5823
|
if(payload.errors){
|
|
5820
5824
|
payload.data.deleteErrorMessage = [];
|
|
5821
5825
|
payload.errors.forEach(function(error){
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
+
try {
|
|
5827
|
+
let errorRecord = error.path.map(function (item) {
|
|
5828
|
+
return item.split('delete__')[1].to_float() + 1;
|
|
5829
|
+
}).toString();
|
|
5830
|
+
payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
|
|
5831
|
+
} catch (error) {
|
|
5832
|
+
console.llg(error)
|
|
5833
|
+
}
|
|
5826
5834
|
})
|
|
5827
5835
|
}
|
|
5828
5836
|
return payload;
|
|
@@ -15290,6 +15298,45 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
15290
15298
|
}
|
|
15291
15299
|
};
|
|
15292
15300
|
|
|
15301
|
+
/*
|
|
15302
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15303
|
+
* @Date: 2025-11-04 12:00:23
|
|
15304
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15305
|
+
* @LastEditTime: 2025-11-11 22:01:39
|
|
15306
|
+
*/
|
|
15307
|
+
|
|
15308
|
+
function approvalCommentsToAmis(field, readonly, ctx) {
|
|
15309
|
+
|
|
15310
|
+
let approvalComments = `
|
|
15311
|
+
'<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') + '">' +
|
|
15312
|
+
'<p class="m-0 p-0">' + (item.isMyApprove ? (instance_my_approve_description || item.description || '') : (item.description || '')) + '</p>' +
|
|
15313
|
+
((item.isMyApprove ? !!(instance_my_approve_description || item.description) : true) ? (item.showApproveSignImage ? item.userSignImage : ('  ' + item.handler_name + ' ')) : '') +
|
|
15314
|
+
(item.finishDateFormated || '') +
|
|
15315
|
+
'</div>'`;
|
|
15316
|
+
let html = `
|
|
15317
|
+
\${JOIN(ARRAYMAP(record.approvalCommentsFields["${field.name}"].comments, item => ${approvalComments}), '') || '  '}
|
|
15318
|
+
`;
|
|
15319
|
+
let approvalCommentsSchema = {
|
|
15320
|
+
"type": "wrapper",
|
|
15321
|
+
"className": "instance-sign",
|
|
15322
|
+
"body": [
|
|
15323
|
+
{
|
|
15324
|
+
"type": "tpl",
|
|
15325
|
+
"tpl": html,
|
|
15326
|
+
"className": "instance-sign-content block m-2.5"
|
|
15327
|
+
},
|
|
15328
|
+
// TODO:签批链接,点击弹出填写签批意见,readonly时不显示签批链接
|
|
15329
|
+
],
|
|
15330
|
+
"size": "none"
|
|
15331
|
+
};
|
|
15332
|
+
let amisSchema = {
|
|
15333
|
+
"type": "control",
|
|
15334
|
+
"label": field.label,
|
|
15335
|
+
"body": [approvalCommentsSchema]
|
|
15336
|
+
};
|
|
15337
|
+
return amisSchema;
|
|
15338
|
+
}
|
|
15339
|
+
|
|
15293
15340
|
const QUICK_SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
|
|
15294
15341
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
15295
15342
|
// const Lookup = require('./lookup');
|
|
@@ -16085,6 +16132,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16085
16132
|
}
|
|
16086
16133
|
}
|
|
16087
16134
|
break;
|
|
16135
|
+
case 'approval_comments':
|
|
16136
|
+
convertData = approvalCommentsToAmis(field);
|
|
16137
|
+
break;
|
|
16088
16138
|
}
|
|
16089
16139
|
if(!___namespace.isEmpty(convertData)){
|
|
16090
16140
|
const className = convertData.className;
|
|
@@ -18722,6 +18772,237 @@ var getDefaultRenderData = function () {
|
|
|
18722
18772
|
};
|
|
18723
18773
|
};
|
|
18724
18774
|
|
|
18775
|
+
/*
|
|
18776
|
+
* @Author: baozhoutao@steedos.com
|
|
18777
|
+
* @Date: 2022-10-08 16:26:26
|
|
18778
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
18779
|
+
* @LastEditTime: 2025-11-11 21:23:23
|
|
18780
|
+
* @Description:
|
|
18781
|
+
*/
|
|
18782
|
+
|
|
18783
|
+
const getTraceApprovesGroupBySteps = (instance, flow) => {
|
|
18784
|
+
if (!instance || !flow) {
|
|
18785
|
+
return {};
|
|
18786
|
+
}
|
|
18787
|
+
|
|
18788
|
+
const steps = flow.steps;
|
|
18789
|
+
const tracesResult = {};
|
|
18790
|
+
|
|
18791
|
+
(instance.traces || []).forEach(trace => {
|
|
18792
|
+
const step = _$1.find(steps, s => s._id === trace.step);
|
|
18793
|
+
const approves = [];
|
|
18794
|
+
|
|
18795
|
+
(trace.approves || []).forEach(approve => {
|
|
18796
|
+
let judge_name = '';
|
|
18797
|
+
if (trace.is_finished === true) {
|
|
18798
|
+
if (approve.judge === 'approved') {
|
|
18799
|
+
judge_name = amisLib.i18next.t("Instance State approved");
|
|
18800
|
+
} else if (approve.judge === 'rejected') {
|
|
18801
|
+
judge_name = amisLib.i18next.t("Instance State rejected");
|
|
18802
|
+
} else if (approve.judge === 'terminated') {
|
|
18803
|
+
judge_name = amisLib.i18next.t("Instance State terminated");
|
|
18804
|
+
} else if (approve.judge === 'reassigned') {
|
|
18805
|
+
judge_name = amisLib.i18next.t("Instance State reassigned");
|
|
18806
|
+
} else if (approve.judge === 'relocated') {
|
|
18807
|
+
judge_name = amisLib.i18next.t("Instance State relocated");
|
|
18808
|
+
} else if (!approve.judge) {
|
|
18809
|
+
judge_name = "";
|
|
18810
|
+
} else {
|
|
18811
|
+
judge_name = "";
|
|
18812
|
+
}
|
|
18813
|
+
} else {
|
|
18814
|
+
judge_name = amisLib.i18next.t("Instance State pending");
|
|
18815
|
+
}
|
|
18816
|
+
|
|
18817
|
+
approves.push({
|
|
18818
|
+
_id: approve._id,
|
|
18819
|
+
handler: approve.user,
|
|
18820
|
+
handler_name: approve.handler_name,
|
|
18821
|
+
handler_organization_name: approve.handler_organization_name,
|
|
18822
|
+
handler_organization_fullname: approve.handler_organization_fullname,
|
|
18823
|
+
finish_date: approve.finish_date,
|
|
18824
|
+
judge: approve.judge,
|
|
18825
|
+
judge_name: judge_name,
|
|
18826
|
+
description: approve.description,
|
|
18827
|
+
is_finished: approve.is_finished,
|
|
18828
|
+
type: approve.type,
|
|
18829
|
+
opinion_fields_code: approve.opinion_fields_code,
|
|
18830
|
+
sign_field_code: approve.sign_field_code,
|
|
18831
|
+
is_read: approve.is_read,
|
|
18832
|
+
sign_show: approve.sign_show
|
|
18833
|
+
});
|
|
18834
|
+
});
|
|
18835
|
+
|
|
18836
|
+
if (step) {
|
|
18837
|
+
if (tracesResult.hasOwnProperty(step.name)) {
|
|
18838
|
+
tracesResult[step.name] = tracesResult[step.name].concat(approves);
|
|
18839
|
+
} else {
|
|
18840
|
+
tracesResult[step.name] = approves;
|
|
18841
|
+
}
|
|
18842
|
+
}
|
|
18843
|
+
});
|
|
18844
|
+
|
|
18845
|
+
return tracesResult;
|
|
18846
|
+
};
|
|
18847
|
+
|
|
18848
|
+
const getTraceApprovesByStep = (instance, flow, stepName, only_cc_opinion) => {
|
|
18849
|
+
if (!instance) return [];
|
|
18850
|
+
|
|
18851
|
+
const is_completed = instance?.state === "completed";
|
|
18852
|
+
let completed_date = 0;
|
|
18853
|
+
if (is_completed) {
|
|
18854
|
+
let lastTrace = _$1.last(instance.traces);
|
|
18855
|
+
completed_date = lastTrace && lastTrace.finish_date ? (new Date(lastTrace.finish_date)).getTime() : 0;
|
|
18856
|
+
}
|
|
18857
|
+
if (is_completed && instance.finish_date) {
|
|
18858
|
+
completed_date = (new Date(instance.finish_date)).getTime();
|
|
18859
|
+
}
|
|
18860
|
+
|
|
18861
|
+
const tracesObj = getTraceApprovesGroupBySteps(instance, flow);
|
|
18862
|
+
|
|
18863
|
+
let approves = _$1.clone(tracesObj[stepName] || []);
|
|
18864
|
+
|
|
18865
|
+
const approve_sort = approvesParam => {
|
|
18866
|
+
return _$1.sortBy(approvesParam, approve => {
|
|
18867
|
+
let date = approve.finish_date ? new Date(approve.finish_date) : new Date();
|
|
18868
|
+
return -date.getTime();
|
|
18869
|
+
}) || [];
|
|
18870
|
+
};
|
|
18871
|
+
|
|
18872
|
+
approves = _$1.filter(approves, a => a.type !== "forward" && a.type !== "distribute" && a.type !== "terminated");
|
|
18873
|
+
|
|
18874
|
+
if (only_cc_opinion) {
|
|
18875
|
+
approves = _$1.filter(approves, a => a.type === "cc");
|
|
18876
|
+
}
|
|
18877
|
+
|
|
18878
|
+
let approves_sorted = approve_sort(approves);
|
|
18879
|
+
|
|
18880
|
+
const approvesGroup = _$1.groupBy(approves, "handler");
|
|
18881
|
+
|
|
18882
|
+
function hasNext(approve, group) {
|
|
18883
|
+
const handlerApproves = group[approve.handler];
|
|
18884
|
+
return _$1.indexOf(handlerApproves, approve) + 1 < handlerApproves.length;
|
|
18885
|
+
}
|
|
18886
|
+
|
|
18887
|
+
approves_sorted.forEach(approve => {
|
|
18888
|
+
// showBlank为false时,签字字段上配置的默认意见不会生效
|
|
18889
|
+
const showBlank = true;//Meteor.settings.public.workflow?.showBlankApproveDescription;
|
|
18890
|
+
if (
|
|
18891
|
+
approve.sign_show !== false
|
|
18892
|
+
&& (approve.description
|
|
18893
|
+
|| (!approve.description && !hasNext(approve, approvesGroup) && !approve.is_finished)
|
|
18894
|
+
|| showBlank
|
|
18895
|
+
)
|
|
18896
|
+
&& approve.judge !== 'terminated'
|
|
18897
|
+
) {
|
|
18898
|
+
approve._display = true;
|
|
18899
|
+
}
|
|
18900
|
+
});
|
|
18901
|
+
|
|
18902
|
+
approves_sorted = _$1.filter(approves_sorted, a => {
|
|
18903
|
+
if (is_completed) {
|
|
18904
|
+
return a._display === true && a.is_finished && a.finish_date && (new Date(a.finish_date)).getTime() <= completed_date;
|
|
18905
|
+
} else {
|
|
18906
|
+
return a._display === true;
|
|
18907
|
+
}
|
|
18908
|
+
});
|
|
18909
|
+
|
|
18910
|
+
return approves_sorted;
|
|
18911
|
+
};
|
|
18912
|
+
|
|
18913
|
+
const isOpinionOfField = (approve, field) => {
|
|
18914
|
+
if (approve.type === "cc" && field.name) {
|
|
18915
|
+
return field.name === approve.sign_field_code;
|
|
18916
|
+
} else {
|
|
18917
|
+
return true;
|
|
18918
|
+
}
|
|
18919
|
+
};
|
|
18920
|
+
|
|
18921
|
+
const isMyApprove = ({ approve, only_cc_opinion, box, currentApprove, field }) => {
|
|
18922
|
+
if (box !== 'inbox') {
|
|
18923
|
+
return false;
|
|
18924
|
+
}
|
|
18925
|
+
|
|
18926
|
+
if (!approve?._id) {
|
|
18927
|
+
approve = currentApprove;
|
|
18928
|
+
}
|
|
18929
|
+
|
|
18930
|
+
if (
|
|
18931
|
+
approve._id === currentApprove?._id &&
|
|
18932
|
+
currentApprove?.type === 'cc' &&
|
|
18933
|
+
field.name
|
|
18934
|
+
) {
|
|
18935
|
+
return ___default["default"].indexOf(currentApprove?.opinion_fields_code, field.name) > -1;
|
|
18936
|
+
}
|
|
18937
|
+
|
|
18938
|
+
if (!(currentApprove?.type === 'cc') && only_cc_opinion) {
|
|
18939
|
+
return false;
|
|
18940
|
+
}
|
|
18941
|
+
|
|
18942
|
+
if (currentApprove && approve._id === currentApprove._id) {
|
|
18943
|
+
return true;
|
|
18944
|
+
}
|
|
18945
|
+
|
|
18946
|
+
return false;
|
|
18947
|
+
};
|
|
18948
|
+
|
|
18949
|
+
const showApprove = (approve, field) => {
|
|
18950
|
+
if (!approve.sign_field_code || approve.sign_field_code === field.name) {
|
|
18951
|
+
if (approve?.is_read) {
|
|
18952
|
+
if (approve.is_finished) {
|
|
18953
|
+
return ["approved", "rejected", "submitted", "readed"].includes(approve.judge);
|
|
18954
|
+
}
|
|
18955
|
+
}
|
|
18956
|
+
}
|
|
18957
|
+
return false;
|
|
18958
|
+
};
|
|
18959
|
+
|
|
18960
|
+
const isReaded = (judge) => {
|
|
18961
|
+
return ["approved", "rejected", "submitted", "readed"].includes(judge);
|
|
18962
|
+
};
|
|
18963
|
+
|
|
18964
|
+
const showApproveDefaultDescription = (approve) => {
|
|
18965
|
+
if (approve.is_finished && isReaded(approve.judge)) {
|
|
18966
|
+
return true;
|
|
18967
|
+
}
|
|
18968
|
+
return false;
|
|
18969
|
+
};
|
|
18970
|
+
|
|
18971
|
+
const showApproveSignImage = (judge) => {
|
|
18972
|
+
return !['returned', 'terminated', 'retrieved'].includes(judge);
|
|
18973
|
+
};
|
|
18974
|
+
|
|
18975
|
+
const getUserApprove = ({ instance, userId }) => {
|
|
18976
|
+
const currentTrace = _$1.find(instance.traces, (trace) => {
|
|
18977
|
+
return trace.is_finished != true;
|
|
18978
|
+
});
|
|
18979
|
+
let currentApprove = null;
|
|
18980
|
+
if (currentTrace) {
|
|
18981
|
+
currentApprove = _$1.find(currentTrace.approves, (approve) => {
|
|
18982
|
+
return approve.is_finished != true && approve.handler == userId;
|
|
18983
|
+
});
|
|
18984
|
+
}
|
|
18985
|
+
|
|
18986
|
+
//传阅的approve返回最新一条
|
|
18987
|
+
if (!currentApprove || currentApprove.type == "cc") {
|
|
18988
|
+
// 当前是传阅
|
|
18989
|
+
___default["default"].each(instance.traces, function (t) {
|
|
18990
|
+
___default["default"].each(t.approves, function (a) {
|
|
18991
|
+
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
18992
|
+
currentApprove = a;
|
|
18993
|
+
}
|
|
18994
|
+
});
|
|
18995
|
+
});
|
|
18996
|
+
}
|
|
18997
|
+
|
|
18998
|
+
if (!currentApprove) return;
|
|
18999
|
+
|
|
19000
|
+
if (currentApprove._id) {
|
|
19001
|
+
currentApprove.id = currentApprove._id;
|
|
19002
|
+
}
|
|
19003
|
+
return currentApprove;
|
|
19004
|
+
};
|
|
19005
|
+
|
|
18725
19006
|
//TODO Meteor.settings.public?.workflow?.hideCounterSignJudgeOptions
|
|
18726
19007
|
|
|
18727
19008
|
const HIDE_COUNTER_SIGN_JUDGE_OPTIONS = false;
|
|
@@ -19290,6 +19571,8 @@ const getSubmitActions = async (instance, submitEvents) => {
|
|
|
19290
19571
|
};
|
|
19291
19572
|
|
|
19292
19573
|
const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
19574
|
+
const userId = amisLib.getSteedosAuth().userId;
|
|
19575
|
+
const userApprove = getUserApprove({ instance, userId });
|
|
19293
19576
|
return {
|
|
19294
19577
|
type: "drawer",
|
|
19295
19578
|
overlay: false,
|
|
@@ -19327,7 +19610,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19327
19610
|
minRows: 3,
|
|
19328
19611
|
maxRows: 20,
|
|
19329
19612
|
placeholder: amisLib.i18next.t('frontend_workflow_suggestion_placeholder'),//"请填写意见",
|
|
19330
|
-
requiredOn: "${judge === 'rejected'}"
|
|
19613
|
+
requiredOn: "${judge === 'rejected'}",
|
|
19614
|
+
value: userApprove?.description,
|
|
19615
|
+
"onEvent": {
|
|
19616
|
+
"change": {
|
|
19617
|
+
"actions": [
|
|
19618
|
+
{
|
|
19619
|
+
"componentId": "u:instancePage",
|
|
19620
|
+
"actionType": "setValue",
|
|
19621
|
+
"args": {
|
|
19622
|
+
"value": {
|
|
19623
|
+
"instance_my_approve_description": "${value}"
|
|
19624
|
+
}
|
|
19625
|
+
}
|
|
19626
|
+
}
|
|
19627
|
+
]
|
|
19628
|
+
}
|
|
19629
|
+
}
|
|
19331
19630
|
},
|
|
19332
19631
|
await getNextStepInput(instance),
|
|
19333
19632
|
await getNextStepUsersInput(instance),
|
|
@@ -19668,7 +19967,7 @@ const getSelectOptions = (field) => {
|
|
|
19668
19967
|
return options;
|
|
19669
19968
|
};
|
|
19670
19969
|
|
|
19671
|
-
const isOpinionField
|
|
19970
|
+
const isOpinionField = (field)=>{
|
|
19672
19971
|
const field_formula = field.formula;
|
|
19673
19972
|
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
19973
|
};
|
|
@@ -19682,7 +19981,7 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
19682
19981
|
disabled: field.permission !== "editable",
|
|
19683
19982
|
required: field.is_required
|
|
19684
19983
|
};
|
|
19685
|
-
if(isOpinionField
|
|
19984
|
+
if(isOpinionField(field)){
|
|
19686
19985
|
tpl.type = 'input-group';
|
|
19687
19986
|
tpl.body = [
|
|
19688
19987
|
{
|
|
@@ -20744,83 +21043,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20744
21043
|
};
|
|
20745
21044
|
};
|
|
20746
21045
|
|
|
20747
|
-
/*
|
|
20748
|
-
* @Author: baozhoutao@steedos.com
|
|
20749
|
-
* @Date: 2022-10-08 16:26:26
|
|
20750
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
20751
|
-
* @LastEditTime: 2022-10-08 16:28:42
|
|
20752
|
-
* @Description:
|
|
20753
|
-
*/
|
|
20754
|
-
|
|
20755
|
-
const isOpinionField = (field_formula)=>{
|
|
20756
|
-
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)
|
|
20757
|
-
};
|
|
20758
|
-
|
|
20759
|
-
const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
20760
|
-
const field_formula = field.formula;
|
|
20761
|
-
var foo1, opinionFields;
|
|
20762
|
-
opinionFields = new Array();
|
|
20763
|
-
if (isOpinionField(field_formula)) {
|
|
20764
|
-
if (field_formula) {
|
|
20765
|
-
foo1 = field_formula.split(";");
|
|
20766
|
-
foo1.forEach(function(foo) {
|
|
20767
|
-
var json_formula, s1, sf, _ref, _ref1;
|
|
20768
|
-
json_formula = {};
|
|
20769
|
-
try {
|
|
20770
|
-
json_formula = eval("(" + foo + ")");
|
|
20771
|
-
} catch (_error) {
|
|
20772
|
-
json_formula = {};
|
|
20773
|
-
}
|
|
20774
|
-
if (json_formula != null ? json_formula.yijianlan : void 0) {
|
|
20775
|
-
sf = {};
|
|
20776
|
-
sf.stepName = json_formula.yijianlan.step;
|
|
20777
|
-
sf.image_sign = json_formula.yijianlan.image_sign || false;
|
|
20778
|
-
sf.only_cc_opinion = json_formula.yijianlan.only_cc || false;
|
|
20779
|
-
sf.default_description = json_formula.yijianlan["default"];
|
|
20780
|
-
sf.only_handler = json_formula.yijianlan.only_handler;
|
|
20781
|
-
sf.top_keywords = json_formula.yijianlan.top_keywords || top_keywords;
|
|
20782
|
-
return opinionFields.push(sf);
|
|
20783
|
-
} else if ((field_formula != null ? field_formula.indexOf("{traces.") : void 0) > -1 || (field_formula != null ? field_formula.indexOf("{signature.traces.") : void 0) > -1) {
|
|
20784
|
-
sf = {
|
|
20785
|
-
only_cc_opinion: false,
|
|
20786
|
-
image_sign: false,
|
|
20787
|
-
top_keywords: top_keywords
|
|
20788
|
-
};
|
|
20789
|
-
if (foo.indexOf("{signature.") > -1) {
|
|
20790
|
-
sf.image_sign = true;
|
|
20791
|
-
foo = foo.replace("{signature.", "");
|
|
20792
|
-
}
|
|
20793
|
-
s1 = foo.replace("{", "").replace("}", "");
|
|
20794
|
-
if (s1.split(".").length > 1) {
|
|
20795
|
-
sf.stepName = s1.split(".")[1];
|
|
20796
|
-
if (opinionFields.filterProperty("stepName", sf.stepName).length > 0) {
|
|
20797
|
-
if ((_ref = opinionFields.findPropertyByPK("stepName", sf.stepName)) != null) {
|
|
20798
|
-
_ref.only_cc_opinion = true;
|
|
20799
|
-
}
|
|
20800
|
-
} else {
|
|
20801
|
-
if (s1.split(".").length > 2) {
|
|
20802
|
-
if (((_ref1 = s1.split(".")[2]) != null ? _ref1.toLocaleLowerCase() : void 0) === 'cc') {
|
|
20803
|
-
sf.only_cc_opinion = true;
|
|
20804
|
-
}
|
|
20805
|
-
}
|
|
20806
|
-
}
|
|
20807
|
-
}
|
|
20808
|
-
return opinionFields.push(sf);
|
|
20809
|
-
}
|
|
20810
|
-
});
|
|
20811
|
-
}
|
|
20812
|
-
}
|
|
20813
|
-
return opinionFields;
|
|
20814
|
-
};
|
|
20815
|
-
|
|
20816
|
-
/*
|
|
20817
|
-
* @Author: baozhoutao@steedos.com
|
|
20818
|
-
* @Date: 2022-09-09 17:47:37
|
|
20819
|
-
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20820
|
-
* @LastEditTime: 2025-11-03 15:17:50
|
|
20821
|
-
* @Description:
|
|
20822
|
-
*/
|
|
20823
|
-
|
|
20824
21046
|
const getMoment = ()=>{
|
|
20825
21047
|
if(window.amisRequire){
|
|
20826
21048
|
return window.amisRequire("moment");
|
|
@@ -20835,37 +21057,6 @@ const getTrace = ({ instance, traceId }) => {
|
|
|
20835
21057
|
});
|
|
20836
21058
|
};
|
|
20837
21059
|
|
|
20838
|
-
const getUserApprove = ({ instance, userId }) => {
|
|
20839
|
-
const currentTrace = _$1.find(instance.traces, (trace) => {
|
|
20840
|
-
return trace.is_finished != true;
|
|
20841
|
-
});
|
|
20842
|
-
let currentApprove = null;
|
|
20843
|
-
if (currentTrace) {
|
|
20844
|
-
currentApprove = _$1.find(currentTrace.approves, (approve) => {
|
|
20845
|
-
return approve.is_finished != true && approve.handler == userId;
|
|
20846
|
-
});
|
|
20847
|
-
}
|
|
20848
|
-
|
|
20849
|
-
//传阅的approve返回最新一条
|
|
20850
|
-
if (!currentApprove || currentApprove.type == "cc") {
|
|
20851
|
-
// 当前是传阅
|
|
20852
|
-
___default["default"].each(instance.traces, function (t) {
|
|
20853
|
-
___default["default"].each(t.approves, function (a) {
|
|
20854
|
-
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
20855
|
-
currentApprove = a;
|
|
20856
|
-
}
|
|
20857
|
-
});
|
|
20858
|
-
});
|
|
20859
|
-
}
|
|
20860
|
-
|
|
20861
|
-
if (!currentApprove) return;
|
|
20862
|
-
|
|
20863
|
-
if (currentApprove._id) {
|
|
20864
|
-
currentApprove.id = currentApprove._id;
|
|
20865
|
-
}
|
|
20866
|
-
return currentApprove;
|
|
20867
|
-
};
|
|
20868
|
-
|
|
20869
21060
|
const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
20870
21061
|
let instanceValues = null;
|
|
20871
21062
|
if (!approve || approve.type === "cc") {
|
|
@@ -20962,10 +21153,6 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
20962
21153
|
return step_id;
|
|
20963
21154
|
};
|
|
20964
21155
|
|
|
20965
|
-
const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
20966
|
-
return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
20967
|
-
};
|
|
20968
|
-
|
|
20969
21156
|
const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
|
|
20970
21157
|
if (traceShowSignImage === false) {
|
|
20971
21158
|
return false;
|
|
@@ -21038,7 +21225,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21038
21225
|
}),
|
|
21039
21226
|
});
|
|
21040
21227
|
|
|
21041
|
-
|
|
21228
|
+
const moment = getMoment();
|
|
21042
21229
|
let userApprove = null;
|
|
21043
21230
|
let trace = null;
|
|
21044
21231
|
let step = null;
|
|
@@ -21073,8 +21260,77 @@ const getInstanceInfo = async (props) => {
|
|
|
21073
21260
|
method: "get",
|
|
21074
21261
|
});
|
|
21075
21262
|
|
|
21076
|
-
const moment = getMoment();
|
|
21077
21263
|
const signImageCache = new Map();
|
|
21264
|
+
const approvalCommentsFields = {};
|
|
21265
|
+
___default["default"].each(formVersion.fields, (field) => {
|
|
21266
|
+
if (field.config?.type === "approval_comments") {
|
|
21267
|
+
approvalCommentsFields[field.code] = ___default["default"].clone(field.config);
|
|
21268
|
+
}
|
|
21269
|
+
if (field.type === 'section') {
|
|
21270
|
+
___default["default"].each(field.fields, (subField) => {
|
|
21271
|
+
if (subField.config?.type === "approval_comments") {
|
|
21272
|
+
approvalCommentsFields[subField.code] = ___default["default"].clone(subField.config);
|
|
21273
|
+
}
|
|
21274
|
+
});
|
|
21275
|
+
}
|
|
21276
|
+
});
|
|
21277
|
+
const myApproveFields = [];
|
|
21278
|
+
for (const field of ___default["default"].values(approvalCommentsFields)) {
|
|
21279
|
+
const fieldSteps = ___default["default"].clone(field.steps);
|
|
21280
|
+
if (fieldSteps && fieldSteps.length > 0) {
|
|
21281
|
+
let fieldComments = [];
|
|
21282
|
+
for (const fieldStep of fieldSteps) {
|
|
21283
|
+
const only_cc_opinion = fieldStep.show_cc && !fieldStep.show_handler;
|
|
21284
|
+
const stepApproves = getTraceApprovesByStep(instance, flowVersion, fieldStep.name, only_cc_opinion);
|
|
21285
|
+
for (const approve of stepApproves) {
|
|
21286
|
+
let userName = approve.handler_name;
|
|
21287
|
+
approve.isOpinionOfField = isOpinionOfField(approve, field);
|
|
21288
|
+
if (approve.isOpinionOfField) {
|
|
21289
|
+
approve.isMyApprove = isMyApprove({ approve, only_cc_opinion, box, currentApprove: userApprove, field });
|
|
21290
|
+
if (approve.isMyApprove) {
|
|
21291
|
+
myApproveFields.push(field);
|
|
21292
|
+
}
|
|
21293
|
+
approve.showApprove = showApprove(approve, field);
|
|
21294
|
+
if (approve.showApprove && !approve.description && fieldStep.default && showApproveDefaultDescription(approve)) {
|
|
21295
|
+
approve.description = fieldStep.default;
|
|
21296
|
+
}
|
|
21297
|
+
if (approve.description){
|
|
21298
|
+
approve.description = approve.description.replace(/\n/g, "<br/>");
|
|
21299
|
+
}
|
|
21300
|
+
if (moment && approve.finish_date){
|
|
21301
|
+
approve.finishDateFormated = moment(approve.finish_date).format("YYYY-MM-DD");
|
|
21302
|
+
}
|
|
21303
|
+
let showSignImage = fieldStep.show_image_sign && showApproveSignImage(approve.judge);
|
|
21304
|
+
if (showSignImage){
|
|
21305
|
+
let userSign, userSignImage;
|
|
21306
|
+
if (signImageCache.has(approve.handler)) {
|
|
21307
|
+
userSign = signImageCache.get(approve.handler);
|
|
21308
|
+
} else {
|
|
21309
|
+
userSign = await getSpaceUserSign(instance.space, approve.handler);
|
|
21310
|
+
signImageCache.set(approve.handler, userSign);
|
|
21311
|
+
}
|
|
21312
|
+
if (userSign){
|
|
21313
|
+
userSignImage = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
|
|
21314
|
+
}
|
|
21315
|
+
approve.showApproveSignImage = !!userSign;
|
|
21316
|
+
approve.userSignImage = userSignImage;
|
|
21317
|
+
}
|
|
21318
|
+
}
|
|
21319
|
+
} fieldComments = ___default["default"].union(fieldComments, stepApproves);
|
|
21320
|
+
} field.comments = fieldComments.filter((comment) => {
|
|
21321
|
+
return comment.isOpinionOfField && (comment.isMyApprove || (comment.showApprove && !!comment.description));
|
|
21322
|
+
});
|
|
21323
|
+
}
|
|
21324
|
+
}
|
|
21325
|
+
if (step?.permissions) {
|
|
21326
|
+
// 字段字段
|
|
21327
|
+
___default["default"].each(approvalCommentsFields, (field) => {
|
|
21328
|
+
delete step.permissions[field.name];
|
|
21329
|
+
if (___default["default"].find(myApproveFields, { name: field.name })) {
|
|
21330
|
+
step.permissions[field.name] = 'editable';
|
|
21331
|
+
}
|
|
21332
|
+
});
|
|
21333
|
+
}
|
|
21078
21334
|
return {
|
|
21079
21335
|
box: box,
|
|
21080
21336
|
_id: instanceId,
|
|
@@ -21093,12 +21349,14 @@ const getInstanceInfo = async (props) => {
|
|
|
21093
21349
|
name: instance.name || instance.form.name,
|
|
21094
21350
|
fields: ___default["default"].map(formVersion.fields, (field) => {
|
|
21095
21351
|
const newField = Object.assign({}, field, {
|
|
21096
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21352
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21353
|
+
permission: userApprove?.type != 'cc' && step?.permissions[field.code],
|
|
21097
21354
|
}) ;
|
|
21098
21355
|
if(field.type === 'section'){
|
|
21099
21356
|
newField.fields = ___default["default"].map(field.fields, (sfield) => {
|
|
21100
21357
|
return Object.assign({}, sfield, {
|
|
21101
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21358
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21359
|
+
permission: userApprove?.type != 'cc' && step?.permissions[sfield.code],
|
|
21102
21360
|
type: sfield._type || sfield.type
|
|
21103
21361
|
});
|
|
21104
21362
|
});
|
|
@@ -21198,6 +21456,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21198
21456
|
{ name: trace.name, judge: "" }
|
|
21199
21457
|
);
|
|
21200
21458
|
})),
|
|
21459
|
+
approvalCommentsFields
|
|
21201
21460
|
};
|
|
21202
21461
|
};
|
|
21203
21462
|
|