@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/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 : ('&emsp;&emsp;' + item.handler_name + '&emsp;')) : '') +
15310
+ (item.finishDateFormated || '') +
15311
+ '</div>'`;
15312
+ let html = `
15313
+ \${JOIN(ARRAYMAP(record.approvalCommentsFields["${field.name}"].comments, item => ${approvalComments}), '') || '&emsp;&emsp;'}
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),
@@ -19668,7 +19963,7 @@ const getSelectOptions = (field) => {
19668
19963
  return options;
19669
19964
  };
19670
19965
 
19671
- const isOpinionField$1 = (field)=>{
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$1(field)){
19980
+ if(isOpinionField(field)){
19686
19981
  tpl.type = 'input-group';
19687
19982
  tpl.body = [
19688
19983
  {
@@ -20744,83 +21039,6 @@ const getFlowFormSchema = async (instance, box) => {
20744
21039
  };
20745
21040
  };
20746
21041
 
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
21042
  const getMoment = ()=>{
20825
21043
  if(window.amisRequire){
20826
21044
  return window.amisRequire("moment");
@@ -20835,37 +21053,6 @@ const getTrace = ({ instance, traceId }) => {
20835
21053
  });
20836
21054
  };
20837
21055
 
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
21056
  const getApproveValues = ({ instance, trace, step, approve, box }) => {
20870
21057
  let instanceValues = null;
20871
21058
  if (!approve || approve.type === "cc") {
@@ -20962,10 +21149,6 @@ const getLastCCStep = ({ traces }, userId) => {
20962
21149
  return step_id;
20963
21150
  };
20964
21151
 
20965
- const isCurrentStepOpinionField = (field, currentStep)=>{
20966
- return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
20967
- };
20968
-
20969
21152
  const isNeedToShowSignImage = (is_finished, judge, traceShowSignImage) => {
20970
21153
  if (traceShowSignImage === false) {
20971
21154
  return false;
@@ -21038,7 +21221,7 @@ const getInstanceInfo = async (props) => {
21038
21221
  }),
21039
21222
  });
21040
21223
 
21041
-
21224
+ const moment = getMoment();
21042
21225
  let userApprove = null;
21043
21226
  let trace = null;
21044
21227
  let step = null;
@@ -21073,8 +21256,77 @@ const getInstanceInfo = async (props) => {
21073
21256
  method: "get",
21074
21257
  });
21075
21258
 
21076
- const moment = getMoment();
21077
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
+ }
21078
21330
  return {
21079
21331
  box: box,
21080
21332
  _id: instanceId,
@@ -21093,12 +21345,14 @@ const getInstanceInfo = async (props) => {
21093
21345
  name: instance.name || instance.form.name,
21094
21346
  fields: ___default["default"].map(formVersion.fields, (field) => {
21095
21347
  const newField = Object.assign({}, field, {
21096
- 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],
21097
21350
  }) ;
21098
21351
  if(field.type === 'section'){
21099
21352
  newField.fields = ___default["default"].map(field.fields, (sfield) => {
21100
21353
  return Object.assign({}, sfield, {
21101
- 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],
21102
21356
  type: sfield._type || sfield.type
21103
21357
  });
21104
21358
  });
@@ -21198,6 +21452,7 @@ const getInstanceInfo = async (props) => {
21198
21452
  { name: trace.name, judge: "" }
21199
21453
  );
21200
21454
  })),
21455
+ approvalCommentsFields
21201
21456
  };
21202
21457
  };
21203
21458