@steedos-widgets/amis-lib 6.10.4 → 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 +374 -119
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +375 -120
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +124 -119
- 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.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _$1 from 'lodash';
|
|
2
|
-
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, has, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, clone, filter, startsWith } from 'lodash';
|
|
2
|
+
import ___default, { isEmpty, isArray, each, find, endsWith, cloneDeep, forEach, includes, trimEnd, has, isBoolean, omitBy, isNil, toArray, mergeWith, get, map, isString, union, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, clone, filter, last, groupBy, sortBy, indexOf, startsWith } from 'lodash';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
export { default as i18next } from 'i18next';
|
|
5
5
|
import { initReactI18next } from 'react-i18next';
|
|
@@ -2826,6 +2826,7 @@ var widget_ed = {
|
|
|
2826
2826
|
"steedos-field_type_file": "Attachment",
|
|
2827
2827
|
"steedos-field_type_formula": "Formula",
|
|
2828
2828
|
"steedos-field_type_summary": "Rollup Summary",
|
|
2829
|
+
"steedos-field_type_approval_comments": "Approval Comments",
|
|
2829
2830
|
"steedos-field_label": "Display Name",
|
|
2830
2831
|
"steedos-field_api_name": "API Name",
|
|
2831
2832
|
"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.",
|
|
@@ -2951,6 +2952,7 @@ var sfield_file = "附件";
|
|
|
2951
2952
|
var sfield_formula = "公式";
|
|
2952
2953
|
var sfield_summary = "累计汇总";
|
|
2953
2954
|
var sfield_table = "表格";
|
|
2955
|
+
var sfield_approval_comments = "审批意见";
|
|
2954
2956
|
var sfield_settings_panel_title = "设置";
|
|
2955
2957
|
var sfield_control_advanced = "高级";
|
|
2956
2958
|
var sfield_control_general = "通用";
|
|
@@ -3123,6 +3125,7 @@ var widget_zh = {
|
|
|
3123
3125
|
sfield_formula: sfield_formula,
|
|
3124
3126
|
sfield_summary: sfield_summary,
|
|
3125
3127
|
sfield_table: sfield_table,
|
|
3128
|
+
sfield_approval_comments: sfield_approval_comments,
|
|
3126
3129
|
sfield_settings_panel_title: sfield_settings_panel_title,
|
|
3127
3130
|
sfield_control_advanced: sfield_control_advanced,
|
|
3128
3131
|
sfield_control_general: sfield_control_general,
|
|
@@ -3610,6 +3613,7 @@ var widget_zh = {
|
|
|
3610
3613
|
"steedos-field_type_file": "附件",
|
|
3611
3614
|
"steedos-field_type_formula": "公式",
|
|
3612
3615
|
"steedos-field_type_summary": "累计汇总",
|
|
3616
|
+
"steedos-field_type_approval_comments": "审批意见",
|
|
3613
3617
|
"steedos-field_label": "显示名称",
|
|
3614
3618
|
"steedos-field_api_name": "API 名称",
|
|
3615
3619
|
"steedos-field_api_name_remark": "API 名称只能包含小写字母、数字,必须以字母开头,不能以下划线字符结尾或包含两个连续的下划线字符",
|
|
@@ -15263,6 +15267,45 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
15263
15267
|
}
|
|
15264
15268
|
};
|
|
15265
15269
|
|
|
15270
|
+
/*
|
|
15271
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15272
|
+
* @Date: 2025-11-04 12:00:23
|
|
15273
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15274
|
+
* @LastEditTime: 2025-11-11 22:01:39
|
|
15275
|
+
*/
|
|
15276
|
+
|
|
15277
|
+
function approvalCommentsToAmis(field, readonly, ctx) {
|
|
15278
|
+
|
|
15279
|
+
let approvalComments = `
|
|
15280
|
+
'<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') + '">' +
|
|
15281
|
+
'<p class="m-0 p-0">' + (item.isMyApprove ? (instance_my_approve_description || item.description || '') : (item.description || '')) + '</p>' +
|
|
15282
|
+
((item.isMyApprove ? !!(instance_my_approve_description || item.description) : true) ? (item.showApproveSignImage ? item.userSignImage : ('  ' + item.handler_name + ' ')) : '') +
|
|
15283
|
+
(item.finishDateFormated || '') +
|
|
15284
|
+
'</div>'`;
|
|
15285
|
+
let html = `
|
|
15286
|
+
\${JOIN(ARRAYMAP(record.approvalCommentsFields["${field.name}"].comments, item => ${approvalComments}), '') || '  '}
|
|
15287
|
+
`;
|
|
15288
|
+
let approvalCommentsSchema = {
|
|
15289
|
+
"type": "wrapper",
|
|
15290
|
+
"className": "instance-sign",
|
|
15291
|
+
"body": [
|
|
15292
|
+
{
|
|
15293
|
+
"type": "tpl",
|
|
15294
|
+
"tpl": html,
|
|
15295
|
+
"className": "instance-sign-content block m-2.5"
|
|
15296
|
+
},
|
|
15297
|
+
// TODO:签批链接,点击弹出填写签批意见,readonly时不显示签批链接
|
|
15298
|
+
],
|
|
15299
|
+
"size": "none"
|
|
15300
|
+
};
|
|
15301
|
+
let amisSchema = {
|
|
15302
|
+
"type": "control",
|
|
15303
|
+
"label": field.label,
|
|
15304
|
+
"body": [approvalCommentsSchema]
|
|
15305
|
+
};
|
|
15306
|
+
return amisSchema;
|
|
15307
|
+
}
|
|
15308
|
+
|
|
15266
15309
|
const QUICK_SEARCHABLE_FIELD_TYPES = ["text", "textarea", "autonumber", "url", "email"];
|
|
15267
15310
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
15268
15311
|
// const Lookup = require('./lookup');
|
|
@@ -16058,6 +16101,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16058
16101
|
}
|
|
16059
16102
|
}
|
|
16060
16103
|
break;
|
|
16104
|
+
case 'approval_comments':
|
|
16105
|
+
convertData = approvalCommentsToAmis(field);
|
|
16106
|
+
break;
|
|
16061
16107
|
}
|
|
16062
16108
|
if(!_$1.isEmpty(convertData)){
|
|
16063
16109
|
const className = convertData.className;
|
|
@@ -18695,6 +18741,237 @@ var getDefaultRenderData = function () {
|
|
|
18695
18741
|
};
|
|
18696
18742
|
};
|
|
18697
18743
|
|
|
18744
|
+
/*
|
|
18745
|
+
* @Author: baozhoutao@steedos.com
|
|
18746
|
+
* @Date: 2022-10-08 16:26:26
|
|
18747
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
18748
|
+
* @LastEditTime: 2025-11-11 21:23:23
|
|
18749
|
+
* @Description:
|
|
18750
|
+
*/
|
|
18751
|
+
|
|
18752
|
+
const getTraceApprovesGroupBySteps = (instance, flow) => {
|
|
18753
|
+
if (!instance || !flow) {
|
|
18754
|
+
return {};
|
|
18755
|
+
}
|
|
18756
|
+
|
|
18757
|
+
const steps = flow.steps;
|
|
18758
|
+
const tracesResult = {};
|
|
18759
|
+
|
|
18760
|
+
(instance.traces || []).forEach(trace => {
|
|
18761
|
+
const step = find(steps, s => s._id === trace.step);
|
|
18762
|
+
const approves = [];
|
|
18763
|
+
|
|
18764
|
+
(trace.approves || []).forEach(approve => {
|
|
18765
|
+
let judge_name = '';
|
|
18766
|
+
if (trace.is_finished === true) {
|
|
18767
|
+
if (approve.judge === 'approved') {
|
|
18768
|
+
judge_name = i18next$1.t("Instance State approved");
|
|
18769
|
+
} else if (approve.judge === 'rejected') {
|
|
18770
|
+
judge_name = i18next$1.t("Instance State rejected");
|
|
18771
|
+
} else if (approve.judge === 'terminated') {
|
|
18772
|
+
judge_name = i18next$1.t("Instance State terminated");
|
|
18773
|
+
} else if (approve.judge === 'reassigned') {
|
|
18774
|
+
judge_name = i18next$1.t("Instance State reassigned");
|
|
18775
|
+
} else if (approve.judge === 'relocated') {
|
|
18776
|
+
judge_name = i18next$1.t("Instance State relocated");
|
|
18777
|
+
} else if (!approve.judge) {
|
|
18778
|
+
judge_name = "";
|
|
18779
|
+
} else {
|
|
18780
|
+
judge_name = "";
|
|
18781
|
+
}
|
|
18782
|
+
} else {
|
|
18783
|
+
judge_name = i18next$1.t("Instance State pending");
|
|
18784
|
+
}
|
|
18785
|
+
|
|
18786
|
+
approves.push({
|
|
18787
|
+
_id: approve._id,
|
|
18788
|
+
handler: approve.user,
|
|
18789
|
+
handler_name: approve.handler_name,
|
|
18790
|
+
handler_organization_name: approve.handler_organization_name,
|
|
18791
|
+
handler_organization_fullname: approve.handler_organization_fullname,
|
|
18792
|
+
finish_date: approve.finish_date,
|
|
18793
|
+
judge: approve.judge,
|
|
18794
|
+
judge_name: judge_name,
|
|
18795
|
+
description: approve.description,
|
|
18796
|
+
is_finished: approve.is_finished,
|
|
18797
|
+
type: approve.type,
|
|
18798
|
+
opinion_fields_code: approve.opinion_fields_code,
|
|
18799
|
+
sign_field_code: approve.sign_field_code,
|
|
18800
|
+
is_read: approve.is_read,
|
|
18801
|
+
sign_show: approve.sign_show
|
|
18802
|
+
});
|
|
18803
|
+
});
|
|
18804
|
+
|
|
18805
|
+
if (step) {
|
|
18806
|
+
if (tracesResult.hasOwnProperty(step.name)) {
|
|
18807
|
+
tracesResult[step.name] = tracesResult[step.name].concat(approves);
|
|
18808
|
+
} else {
|
|
18809
|
+
tracesResult[step.name] = approves;
|
|
18810
|
+
}
|
|
18811
|
+
}
|
|
18812
|
+
});
|
|
18813
|
+
|
|
18814
|
+
return tracesResult;
|
|
18815
|
+
};
|
|
18816
|
+
|
|
18817
|
+
const getTraceApprovesByStep = (instance, flow, stepName, only_cc_opinion) => {
|
|
18818
|
+
if (!instance) return [];
|
|
18819
|
+
|
|
18820
|
+
const is_completed = instance?.state === "completed";
|
|
18821
|
+
let completed_date = 0;
|
|
18822
|
+
if (is_completed) {
|
|
18823
|
+
let lastTrace = last(instance.traces);
|
|
18824
|
+
completed_date = lastTrace && lastTrace.finish_date ? (new Date(lastTrace.finish_date)).getTime() : 0;
|
|
18825
|
+
}
|
|
18826
|
+
if (is_completed && instance.finish_date) {
|
|
18827
|
+
completed_date = (new Date(instance.finish_date)).getTime();
|
|
18828
|
+
}
|
|
18829
|
+
|
|
18830
|
+
const tracesObj = getTraceApprovesGroupBySteps(instance, flow);
|
|
18831
|
+
|
|
18832
|
+
let approves = clone(tracesObj[stepName] || []);
|
|
18833
|
+
|
|
18834
|
+
const approve_sort = approvesParam => {
|
|
18835
|
+
return sortBy(approvesParam, approve => {
|
|
18836
|
+
let date = approve.finish_date ? new Date(approve.finish_date) : new Date();
|
|
18837
|
+
return -date.getTime();
|
|
18838
|
+
}) || [];
|
|
18839
|
+
};
|
|
18840
|
+
|
|
18841
|
+
approves = filter(approves, a => a.type !== "forward" && a.type !== "distribute" && a.type !== "terminated");
|
|
18842
|
+
|
|
18843
|
+
if (only_cc_opinion) {
|
|
18844
|
+
approves = filter(approves, a => a.type === "cc");
|
|
18845
|
+
}
|
|
18846
|
+
|
|
18847
|
+
let approves_sorted = approve_sort(approves);
|
|
18848
|
+
|
|
18849
|
+
const approvesGroup = groupBy(approves, "handler");
|
|
18850
|
+
|
|
18851
|
+
function hasNext(approve, group) {
|
|
18852
|
+
const handlerApproves = group[approve.handler];
|
|
18853
|
+
return indexOf(handlerApproves, approve) + 1 < handlerApproves.length;
|
|
18854
|
+
}
|
|
18855
|
+
|
|
18856
|
+
approves_sorted.forEach(approve => {
|
|
18857
|
+
// showBlank为false时,签字字段上配置的默认意见不会生效
|
|
18858
|
+
const showBlank = true;//Meteor.settings.public.workflow?.showBlankApproveDescription;
|
|
18859
|
+
if (
|
|
18860
|
+
approve.sign_show !== false
|
|
18861
|
+
&& (approve.description
|
|
18862
|
+
|| (!approve.description && !hasNext(approve, approvesGroup) && !approve.is_finished)
|
|
18863
|
+
|| showBlank
|
|
18864
|
+
)
|
|
18865
|
+
&& approve.judge !== 'terminated'
|
|
18866
|
+
) {
|
|
18867
|
+
approve._display = true;
|
|
18868
|
+
}
|
|
18869
|
+
});
|
|
18870
|
+
|
|
18871
|
+
approves_sorted = filter(approves_sorted, a => {
|
|
18872
|
+
if (is_completed) {
|
|
18873
|
+
return a._display === true && a.is_finished && a.finish_date && (new Date(a.finish_date)).getTime() <= completed_date;
|
|
18874
|
+
} else {
|
|
18875
|
+
return a._display === true;
|
|
18876
|
+
}
|
|
18877
|
+
});
|
|
18878
|
+
|
|
18879
|
+
return approves_sorted;
|
|
18880
|
+
};
|
|
18881
|
+
|
|
18882
|
+
const isOpinionOfField = (approve, field) => {
|
|
18883
|
+
if (approve.type === "cc" && field.name) {
|
|
18884
|
+
return field.name === approve.sign_field_code;
|
|
18885
|
+
} else {
|
|
18886
|
+
return true;
|
|
18887
|
+
}
|
|
18888
|
+
};
|
|
18889
|
+
|
|
18890
|
+
const isMyApprove = ({ approve, only_cc_opinion, box, currentApprove, field }) => {
|
|
18891
|
+
if (box !== 'inbox') {
|
|
18892
|
+
return false;
|
|
18893
|
+
}
|
|
18894
|
+
|
|
18895
|
+
if (!approve?._id) {
|
|
18896
|
+
approve = currentApprove;
|
|
18897
|
+
}
|
|
18898
|
+
|
|
18899
|
+
if (
|
|
18900
|
+
approve._id === currentApprove?._id &&
|
|
18901
|
+
currentApprove?.type === 'cc' &&
|
|
18902
|
+
field.name
|
|
18903
|
+
) {
|
|
18904
|
+
return ___default.indexOf(currentApprove?.opinion_fields_code, field.name) > -1;
|
|
18905
|
+
}
|
|
18906
|
+
|
|
18907
|
+
if (!(currentApprove?.type === 'cc') && only_cc_opinion) {
|
|
18908
|
+
return false;
|
|
18909
|
+
}
|
|
18910
|
+
|
|
18911
|
+
if (currentApprove && approve._id === currentApprove._id) {
|
|
18912
|
+
return true;
|
|
18913
|
+
}
|
|
18914
|
+
|
|
18915
|
+
return false;
|
|
18916
|
+
};
|
|
18917
|
+
|
|
18918
|
+
const showApprove = (approve, field) => {
|
|
18919
|
+
if (!approve.sign_field_code || approve.sign_field_code === field.name) {
|
|
18920
|
+
if (approve?.is_read) {
|
|
18921
|
+
if (approve.is_finished) {
|
|
18922
|
+
return ["approved", "rejected", "submitted", "readed"].includes(approve.judge);
|
|
18923
|
+
}
|
|
18924
|
+
}
|
|
18925
|
+
}
|
|
18926
|
+
return false;
|
|
18927
|
+
};
|
|
18928
|
+
|
|
18929
|
+
const isReaded = (judge) => {
|
|
18930
|
+
return ["approved", "rejected", "submitted", "readed"].includes(judge);
|
|
18931
|
+
};
|
|
18932
|
+
|
|
18933
|
+
const showApproveDefaultDescription = (approve) => {
|
|
18934
|
+
if (approve.is_finished && isReaded(approve.judge)) {
|
|
18935
|
+
return true;
|
|
18936
|
+
}
|
|
18937
|
+
return false;
|
|
18938
|
+
};
|
|
18939
|
+
|
|
18940
|
+
const showApproveSignImage = (judge) => {
|
|
18941
|
+
return !['returned', 'terminated', 'retrieved'].includes(judge);
|
|
18942
|
+
};
|
|
18943
|
+
|
|
18944
|
+
const getUserApprove = ({ instance, userId }) => {
|
|
18945
|
+
const currentTrace = find(instance.traces, (trace) => {
|
|
18946
|
+
return trace.is_finished != true;
|
|
18947
|
+
});
|
|
18948
|
+
let currentApprove = null;
|
|
18949
|
+
if (currentTrace) {
|
|
18950
|
+
currentApprove = find(currentTrace.approves, (approve) => {
|
|
18951
|
+
return approve.is_finished != true && approve.handler == userId;
|
|
18952
|
+
});
|
|
18953
|
+
}
|
|
18954
|
+
|
|
18955
|
+
//传阅的approve返回最新一条
|
|
18956
|
+
if (!currentApprove || currentApprove.type == "cc") {
|
|
18957
|
+
// 当前是传阅
|
|
18958
|
+
___default.each(instance.traces, function (t) {
|
|
18959
|
+
___default.each(t.approves, function (a) {
|
|
18960
|
+
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
18961
|
+
currentApprove = a;
|
|
18962
|
+
}
|
|
18963
|
+
});
|
|
18964
|
+
});
|
|
18965
|
+
}
|
|
18966
|
+
|
|
18967
|
+
if (!currentApprove) return;
|
|
18968
|
+
|
|
18969
|
+
if (currentApprove._id) {
|
|
18970
|
+
currentApprove.id = currentApprove._id;
|
|
18971
|
+
}
|
|
18972
|
+
return currentApprove;
|
|
18973
|
+
};
|
|
18974
|
+
|
|
18698
18975
|
//TODO Meteor.settings.public?.workflow?.hideCounterSignJudgeOptions
|
|
18699
18976
|
|
|
18700
18977
|
const HIDE_COUNTER_SIGN_JUDGE_OPTIONS = false;
|
|
@@ -19263,6 +19540,8 @@ const getSubmitActions = async (instance, submitEvents) => {
|
|
|
19263
19540
|
};
|
|
19264
19541
|
|
|
19265
19542
|
const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
19543
|
+
const userId = getSteedosAuth$1().userId;
|
|
19544
|
+
const userApprove = getUserApprove({ instance, userId });
|
|
19266
19545
|
return {
|
|
19267
19546
|
type: "drawer",
|
|
19268
19547
|
overlay: false,
|
|
@@ -19300,7 +19579,23 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19300
19579
|
minRows: 3,
|
|
19301
19580
|
maxRows: 20,
|
|
19302
19581
|
placeholder: i18next$1.t('frontend_workflow_suggestion_placeholder'),//"请填写意见",
|
|
19303
|
-
requiredOn: "${judge === 'rejected'}"
|
|
19582
|
+
requiredOn: "${judge === 'rejected'}",
|
|
19583
|
+
value: userApprove?.description,
|
|
19584
|
+
"onEvent": {
|
|
19585
|
+
"change": {
|
|
19586
|
+
"actions": [
|
|
19587
|
+
{
|
|
19588
|
+
"componentId": "u:instancePage",
|
|
19589
|
+
"actionType": "setValue",
|
|
19590
|
+
"args": {
|
|
19591
|
+
"value": {
|
|
19592
|
+
"instance_my_approve_description": "${value}"
|
|
19593
|
+
}
|
|
19594
|
+
}
|
|
19595
|
+
}
|
|
19596
|
+
]
|
|
19597
|
+
}
|
|
19598
|
+
}
|
|
19304
19599
|
},
|
|
19305
19600
|
await getNextStepInput(instance),
|
|
19306
19601
|
await getNextStepUsersInput(instance),
|
|
@@ -19641,7 +19936,7 @@ const getSelectOptions = (field) => {
|
|
|
19641
19936
|
return options;
|
|
19642
19937
|
};
|
|
19643
19938
|
|
|
19644
|
-
const isOpinionField
|
|
19939
|
+
const isOpinionField = (field)=>{
|
|
19645
19940
|
const field_formula = field.formula;
|
|
19646
19941
|
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)
|
|
19647
19942
|
};
|
|
@@ -19655,7 +19950,7 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
19655
19950
|
disabled: field.permission !== "editable",
|
|
19656
19951
|
required: field.is_required
|
|
19657
19952
|
};
|
|
19658
|
-
if(isOpinionField
|
|
19953
|
+
if(isOpinionField(field)){
|
|
19659
19954
|
tpl.type = 'input-group';
|
|
19660
19955
|
tpl.body = [
|
|
19661
19956
|
{
|
|
@@ -20717,83 +21012,6 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20717
21012
|
};
|
|
20718
21013
|
};
|
|
20719
21014
|
|
|
20720
|
-
/*
|
|
20721
|
-
* @Author: baozhoutao@steedos.com
|
|
20722
|
-
* @Date: 2022-10-08 16:26:26
|
|
20723
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
20724
|
-
* @LastEditTime: 2022-10-08 16:28:42
|
|
20725
|
-
* @Description:
|
|
20726
|
-
*/
|
|
20727
|
-
|
|
20728
|
-
const isOpinionField = (field_formula)=>{
|
|
20729
|
-
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)
|
|
20730
|
-
};
|
|
20731
|
-
|
|
20732
|
-
const getOpinionFieldStepsName = (field, top_keywords) => {
|
|
20733
|
-
const field_formula = field.formula;
|
|
20734
|
-
var foo1, opinionFields;
|
|
20735
|
-
opinionFields = new Array();
|
|
20736
|
-
if (isOpinionField(field_formula)) {
|
|
20737
|
-
if (field_formula) {
|
|
20738
|
-
foo1 = field_formula.split(";");
|
|
20739
|
-
foo1.forEach(function(foo) {
|
|
20740
|
-
var json_formula, s1, sf, _ref, _ref1;
|
|
20741
|
-
json_formula = {};
|
|
20742
|
-
try {
|
|
20743
|
-
json_formula = eval("(" + foo + ")");
|
|
20744
|
-
} catch (_error) {
|
|
20745
|
-
json_formula = {};
|
|
20746
|
-
}
|
|
20747
|
-
if (json_formula != null ? json_formula.yijianlan : void 0) {
|
|
20748
|
-
sf = {};
|
|
20749
|
-
sf.stepName = json_formula.yijianlan.step;
|
|
20750
|
-
sf.image_sign = json_formula.yijianlan.image_sign || false;
|
|
20751
|
-
sf.only_cc_opinion = json_formula.yijianlan.only_cc || false;
|
|
20752
|
-
sf.default_description = json_formula.yijianlan["default"];
|
|
20753
|
-
sf.only_handler = json_formula.yijianlan.only_handler;
|
|
20754
|
-
sf.top_keywords = json_formula.yijianlan.top_keywords || top_keywords;
|
|
20755
|
-
return opinionFields.push(sf);
|
|
20756
|
-
} else if ((field_formula != null ? field_formula.indexOf("{traces.") : void 0) > -1 || (field_formula != null ? field_formula.indexOf("{signature.traces.") : void 0) > -1) {
|
|
20757
|
-
sf = {
|
|
20758
|
-
only_cc_opinion: false,
|
|
20759
|
-
image_sign: false,
|
|
20760
|
-
top_keywords: top_keywords
|
|
20761
|
-
};
|
|
20762
|
-
if (foo.indexOf("{signature.") > -1) {
|
|
20763
|
-
sf.image_sign = true;
|
|
20764
|
-
foo = foo.replace("{signature.", "");
|
|
20765
|
-
}
|
|
20766
|
-
s1 = foo.replace("{", "").replace("}", "");
|
|
20767
|
-
if (s1.split(".").length > 1) {
|
|
20768
|
-
sf.stepName = s1.split(".")[1];
|
|
20769
|
-
if (opinionFields.filterProperty("stepName", sf.stepName).length > 0) {
|
|
20770
|
-
if ((_ref = opinionFields.findPropertyByPK("stepName", sf.stepName)) != null) {
|
|
20771
|
-
_ref.only_cc_opinion = true;
|
|
20772
|
-
}
|
|
20773
|
-
} else {
|
|
20774
|
-
if (s1.split(".").length > 2) {
|
|
20775
|
-
if (((_ref1 = s1.split(".")[2]) != null ? _ref1.toLocaleLowerCase() : void 0) === 'cc') {
|
|
20776
|
-
sf.only_cc_opinion = true;
|
|
20777
|
-
}
|
|
20778
|
-
}
|
|
20779
|
-
}
|
|
20780
|
-
}
|
|
20781
|
-
return opinionFields.push(sf);
|
|
20782
|
-
}
|
|
20783
|
-
});
|
|
20784
|
-
}
|
|
20785
|
-
}
|
|
20786
|
-
return opinionFields;
|
|
20787
|
-
};
|
|
20788
|
-
|
|
20789
|
-
/*
|
|
20790
|
-
* @Author: baozhoutao@steedos.com
|
|
20791
|
-
* @Date: 2022-09-09 17:47:37
|
|
20792
|
-
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
20793
|
-
* @LastEditTime: 2025-11-03 15:17:50
|
|
20794
|
-
* @Description:
|
|
20795
|
-
*/
|
|
20796
|
-
|
|
20797
21015
|
const getMoment = ()=>{
|
|
20798
21016
|
if(window.amisRequire){
|
|
20799
21017
|
return window.amisRequire("moment");
|
|
@@ -20808,37 +21026,6 @@ const getTrace = ({ instance, traceId }) => {
|
|
|
20808
21026
|
});
|
|
20809
21027
|
};
|
|
20810
21028
|
|
|
20811
|
-
const getUserApprove = ({ instance, userId }) => {
|
|
20812
|
-
const currentTrace = find(instance.traces, (trace) => {
|
|
20813
|
-
return trace.is_finished != true;
|
|
20814
|
-
});
|
|
20815
|
-
let currentApprove = null;
|
|
20816
|
-
if (currentTrace) {
|
|
20817
|
-
currentApprove = find(currentTrace.approves, (approve) => {
|
|
20818
|
-
return approve.is_finished != true && approve.handler == userId;
|
|
20819
|
-
});
|
|
20820
|
-
}
|
|
20821
|
-
|
|
20822
|
-
//传阅的approve返回最新一条
|
|
20823
|
-
if (!currentApprove || currentApprove.type == "cc") {
|
|
20824
|
-
// 当前是传阅
|
|
20825
|
-
___default.each(instance.traces, function (t) {
|
|
20826
|
-
___default.each(t.approves, function (a) {
|
|
20827
|
-
if (a.type == "cc" && a.handler == userId && a.is_finished == false) {
|
|
20828
|
-
currentApprove = a;
|
|
20829
|
-
}
|
|
20830
|
-
});
|
|
20831
|
-
});
|
|
20832
|
-
}
|
|
20833
|
-
|
|
20834
|
-
if (!currentApprove) return;
|
|
20835
|
-
|
|
20836
|
-
if (currentApprove._id) {
|
|
20837
|
-
currentApprove.id = currentApprove._id;
|
|
20838
|
-
}
|
|
20839
|
-
return currentApprove;
|
|
20840
|
-
};
|
|
20841
|
-
|
|
20842
21029
|
const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
20843
21030
|
let instanceValues = null;
|
|
20844
21031
|
if (!approve || approve.type === "cc") {
|
|
@@ -20935,10 +21122,6 @@ const getLastCCStep = ({ traces }, userId) => {
|
|
|
20935
21122
|
return step_id;
|
|
20936
21123
|
};
|
|
20937
21124
|
|
|
20938
|
-
const isCurrentStepOpinionField = (field, currentStep)=>{
|
|
20939
|
-
return ___default.includes(___default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
|
|
20940
|
-
};
|
|
20941
|
-
|
|
20942
21125
|
const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
|
|
20943
21126
|
if (traceShowSignImage === false) {
|
|
20944
21127
|
return false;
|
|
@@ -21011,7 +21194,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21011
21194
|
}),
|
|
21012
21195
|
});
|
|
21013
21196
|
|
|
21014
|
-
|
|
21197
|
+
const moment = getMoment();
|
|
21015
21198
|
let userApprove = null;
|
|
21016
21199
|
let trace = null;
|
|
21017
21200
|
let step = null;
|
|
@@ -21046,8 +21229,77 @@ const getInstanceInfo = async (props) => {
|
|
|
21046
21229
|
method: "get",
|
|
21047
21230
|
});
|
|
21048
21231
|
|
|
21049
|
-
const moment = getMoment();
|
|
21050
21232
|
const signImageCache = new Map();
|
|
21233
|
+
const approvalCommentsFields = {};
|
|
21234
|
+
___default.each(formVersion.fields, (field) => {
|
|
21235
|
+
if (field.config?.type === "approval_comments") {
|
|
21236
|
+
approvalCommentsFields[field.code] = ___default.clone(field.config);
|
|
21237
|
+
}
|
|
21238
|
+
if (field.type === 'section') {
|
|
21239
|
+
___default.each(field.fields, (subField) => {
|
|
21240
|
+
if (subField.config?.type === "approval_comments") {
|
|
21241
|
+
approvalCommentsFields[subField.code] = ___default.clone(subField.config);
|
|
21242
|
+
}
|
|
21243
|
+
});
|
|
21244
|
+
}
|
|
21245
|
+
});
|
|
21246
|
+
const myApproveFields = [];
|
|
21247
|
+
for (const field of ___default.values(approvalCommentsFields)) {
|
|
21248
|
+
const fieldSteps = ___default.clone(field.steps);
|
|
21249
|
+
if (fieldSteps && fieldSteps.length > 0) {
|
|
21250
|
+
let fieldComments = [];
|
|
21251
|
+
for (const fieldStep of fieldSteps) {
|
|
21252
|
+
const only_cc_opinion = fieldStep.show_cc && !fieldStep.show_handler;
|
|
21253
|
+
const stepApproves = getTraceApprovesByStep(instance, flowVersion, fieldStep.name, only_cc_opinion);
|
|
21254
|
+
for (const approve of stepApproves) {
|
|
21255
|
+
let userName = approve.user_name;
|
|
21256
|
+
approve.isOpinionOfField = isOpinionOfField(approve, field);
|
|
21257
|
+
if (approve.isOpinionOfField) {
|
|
21258
|
+
approve.isMyApprove = isMyApprove({ approve, only_cc_opinion, box, currentApprove: userApprove, field });
|
|
21259
|
+
if (approve.isMyApprove) {
|
|
21260
|
+
myApproveFields.push(field);
|
|
21261
|
+
}
|
|
21262
|
+
approve.showApprove = showApprove(approve, field);
|
|
21263
|
+
if (approve.showApprove && !approve.description && fieldStep.default && showApproveDefaultDescription(approve)) {
|
|
21264
|
+
approve.description = fieldStep.default;
|
|
21265
|
+
}
|
|
21266
|
+
if (approve.description){
|
|
21267
|
+
approve.description = approve.description.replace(/\n/g, "<br/>");
|
|
21268
|
+
}
|
|
21269
|
+
if (moment && approve.finish_date){
|
|
21270
|
+
approve.finishDateFormated = moment(approve.finish_date).format("YYYY-MM-DD");
|
|
21271
|
+
}
|
|
21272
|
+
let showSignImage = fieldStep.show_image_sign && showApproveSignImage(approve.judge);
|
|
21273
|
+
if (showSignImage){
|
|
21274
|
+
let userSign, userSignImage;
|
|
21275
|
+
if (signImageCache.has(approve.handler)) {
|
|
21276
|
+
userSign = signImageCache.get(approve.handler);
|
|
21277
|
+
} else {
|
|
21278
|
+
userSign = await getSpaceUserSign(instance.space, approve.handler);
|
|
21279
|
+
signImageCache.set(approve.handler, userSign);
|
|
21280
|
+
}
|
|
21281
|
+
if (userSign){
|
|
21282
|
+
userSignImage = `<img class="image-sign" alt="${userName}" src="/api/v6/files/download/cfs.avatars.filerecord/${userSign}" />`;
|
|
21283
|
+
}
|
|
21284
|
+
approve.showApproveSignImage = !!userSign;
|
|
21285
|
+
approve.userSignImage = userSignImage;
|
|
21286
|
+
}
|
|
21287
|
+
}
|
|
21288
|
+
} fieldComments = ___default.union(fieldComments, stepApproves);
|
|
21289
|
+
} field.comments = fieldComments.filter((comment) => {
|
|
21290
|
+
return comment.isOpinionOfField && (comment.isMyApprove || (comment.showApprove && !!comment.description));
|
|
21291
|
+
});
|
|
21292
|
+
}
|
|
21293
|
+
}
|
|
21294
|
+
if (step?.permissions) {
|
|
21295
|
+
// 字段字段
|
|
21296
|
+
___default.each(approvalCommentsFields, (field) => {
|
|
21297
|
+
delete step.permissions[field.name];
|
|
21298
|
+
if (___default.find(myApproveFields, { name: field.name })) {
|
|
21299
|
+
step.permissions[field.name] = 'editable';
|
|
21300
|
+
}
|
|
21301
|
+
});
|
|
21302
|
+
}
|
|
21051
21303
|
return {
|
|
21052
21304
|
box: box,
|
|
21053
21305
|
_id: instanceId,
|
|
@@ -21066,12 +21318,14 @@ const getInstanceInfo = async (props) => {
|
|
|
21066
21318
|
name: instance.name || instance.form.name,
|
|
21067
21319
|
fields: ___default.map(formVersion.fields, (field) => {
|
|
21068
21320
|
const newField = Object.assign({}, field, {
|
|
21069
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21321
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
|
|
21322
|
+
permission: userApprove?.type != 'cc' && step?.permissions[field.code],
|
|
21070
21323
|
}) ;
|
|
21071
21324
|
if(field.type === 'section'){
|
|
21072
21325
|
newField.fields = ___default.map(field.fields, (sfield) => {
|
|
21073
21326
|
return Object.assign({}, sfield, {
|
|
21074
|
-
permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21327
|
+
// permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
|
|
21328
|
+
permission: userApprove?.type != 'cc' && step?.permissions[sfield.code],
|
|
21075
21329
|
type: sfield._type || sfield.type
|
|
21076
21330
|
});
|
|
21077
21331
|
});
|
|
@@ -21171,6 +21425,7 @@ const getInstanceInfo = async (props) => {
|
|
|
21171
21425
|
{ name: trace.name, judge: "" }
|
|
21172
21426
|
);
|
|
21173
21427
|
})),
|
|
21428
|
+
approvalCommentsFields
|
|
21174
21429
|
};
|
|
21175
21430
|
};
|
|
21176
21431
|
|