@steedos-widgets/amis-lib 6.10.1-beta.38 → 6.10.1-beta.39

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
@@ -16946,6 +16946,13 @@ const getNextStepInput = async (instance) => {
16946
16946
  return api;
16947
16947
  `,
16948
16948
  "adaptor": `
16949
+ if(payload.error){
16950
+ SteedosUI.notification.error({message: payload.error});
16951
+ return {
16952
+ status: 0,
16953
+ data: {}
16954
+ }
16955
+ }
16949
16956
  payload.data = {
16950
16957
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
16951
16958
  options: _.map(payload.nextSteps, (item)=>{
@@ -17023,53 +17030,95 @@ const getNextStepUsersInput = async (instance) => {
17023
17030
  },
17024
17031
  {
17025
17032
  body: [
17026
- // TODO 处理下一步处理人默认值
17027
- Object.assign({},
17028
- {
17029
- "type": "steedos-select-user"
17030
- },
17031
17033
  {
17034
+ type: "steedos-select-user",
17035
+ label: "",
17032
17036
  name: "next_users",
17033
17037
  hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
17034
17038
  required: true
17035
- }),
17039
+ },
17036
17040
  {
17037
- type: "steedos-select-user",
17041
+ type: "list-select",
17038
17042
  label: "",
17039
17043
  name: "next_users",
17040
17044
  id: "u:next_users",
17041
17045
  required: true,
17042
17046
  hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
17043
- amis: {
17044
- multiple: "this.new_next_step.deal_type === 'counterSign'",
17045
- "source": {
17046
- "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
17047
- "method": "post",
17048
- "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17049
- "headers": {
17050
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17051
- },
17052
- "messages": {
17053
- },
17054
- "requestAdaptor": "\nconst { context, next_step, $scopeId } = api.data;\nconst formValues = SteedosUI.getRef($scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
17055
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17056
- "data": {
17057
- "&": "$$",
17058
- "$scopeId": "$scopeId",
17059
- "context": "${context}",
17060
- "next_step": "${new_next_step}",
17061
- }
17047
+ multiple: "this.new_next_step.deal_type === 'counterSign'",
17048
+ "source": {
17049
+ "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers?next_step=${next_step}",
17050
+ "method": "post",
17051
+ "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17052
+ "headers": {
17053
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17062
17054
  },
17063
- "labelField": "name",
17064
- "valueField": "id",
17065
- }
17066
- }
17055
+ "messages": {
17056
+ },
17057
+ "requestAdaptor": "\nconst { next_step, $scopeId } = api.data;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: api.data.context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
17058
+ "adaptor": `
17059
+ if(payload.error){
17060
+ SteedosUI.notification.error({message: payload.error});
17061
+ return {
17062
+ status: 0,
17063
+ data: {}
17064
+ }
17065
+ }
17066
+ payload.data = {
17067
+ value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null,
17068
+ options: payload.nextStepUsers
17069
+ };
17070
+ return payload;`,
17071
+ "data": {
17072
+ "&": "$$",
17073
+ "$scopeId": "$scopeId",
17074
+ "context": "${context}",
17075
+ "next_step": "${new_next_step}",
17076
+ }
17077
+ },
17078
+ "labelField": "name",
17079
+ "valueField": "id",
17080
+ value: '${new_next_step.approver_users}',
17081
+ "joinValues": false,
17082
+ "extractValue": true,
17083
+ },
17084
+ // {
17085
+ // type: "steedos-select-user",
17086
+ // label: "",
17087
+ // name: "next_users",
17088
+ // id: "u:next_users",
17089
+ // required: true,
17090
+ // hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
17091
+ // amis: {
17092
+ // multiple: "this.new_next_step.deal_type === 'counterSign'",
17093
+ // "source": {
17094
+ // "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
17095
+ // "method": "post",
17096
+ // "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17097
+ // "headers": {
17098
+ // "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17099
+ // },
17100
+ // "messages": {
17101
+ // },
17102
+ // "requestAdaptor": "\nconst { next_step, $scopeId } = api.data;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: api.data.context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
17103
+ // "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17104
+ // "data": {
17105
+ // "&": "$$",
17106
+ // "$scopeId": "$scopeId",
17107
+ // "context": "${context}",
17108
+ // "next_step": "${new_next_step}",
17109
+ // }
17110
+ // },
17111
+ // "labelField": "name",
17112
+ // "valueField": "id",
17113
+ // value: '${new_next_step.approver_users}',
17114
+ // }
17115
+ // }
17067
17116
  ],
17068
17117
  id: "u:81a4913c61cc",
17069
17118
  },
17070
17119
  ],
17071
17120
  id: "u:ffff15b76c89",
17072
- className: "b-a b-1x p-xs m-b-none m-l-none m-r-none m-t-sm",
17121
+ className: "b-a b-1x p-xs m-b-none m-l-none m-r-none m-t-sm ${record.step.step_type == 'counterSign' ? 'hidden' : ''}",
17073
17122
  subFormMode: "",
17074
17123
  hiddenOn: "!!!this.new_next_step || (this.new_next_step && this.new_next_step.step_type === 'end')"
17075
17124
  };
@@ -17109,14 +17158,13 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17109
17158
  _id: "${instance.approve._id}",
17110
17159
  next_steps: [{
17111
17160
  step: approveValues.next_step,
17112
- users: nextUsers,
17161
+ users: nextUsers || [],
17113
17162
  }],
17114
17163
  description: approveValues.suggestion,
17115
17164
  values: formValues
17116
17165
  }]
17117
17166
  }]
17118
17167
  }]};
17119
- console.log('submit api', api);
17120
17168
  api.data = body;
17121
17169
  return api;
17122
17170
  `;
@@ -17137,7 +17185,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17137
17185
  _id: "${instance.approve._id}",
17138
17186
  next_steps: [{
17139
17187
  step: approveValues.next_step,
17140
- users: nextUsers,
17188
+ users: nextUsers || [],
17141
17189
  }],
17142
17190
  description: approveValues.suggestion,
17143
17191
  values: formValues
@@ -17155,7 +17203,6 @@ const getPostEngineRequestAdaptor = async (instance) => {
17155
17203
  * @returns
17156
17204
  */
17157
17205
  const getSubmitActions = async (instance) => {
17158
- console.log(`getSubmitActions instance====`, instance);
17159
17206
  let api = "";
17160
17207
  let requestAdaptor = "";
17161
17208
  if(instance.approve?.type == "cc"){
@@ -17172,9 +17219,6 @@ const getSubmitActions = async (instance) => {
17172
17219
  return null; //TODO 考虑异常情况?
17173
17220
  }
17174
17221
  }
17175
- console.log(`getSubmitActions api====`, api);
17176
- console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
17177
- console.log('getObjectListViewPath========>', amisLib.Router.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
17178
17222
  return [
17179
17223
  // 校验表单
17180
17224
  {
@@ -17182,7 +17226,6 @@ const getSubmitActions = async (instance) => {
17182
17226
  "args": {},
17183
17227
  "actionType": "custom",
17184
17228
  "script": `
17185
- console.log("======getSubmitActions");
17186
17229
  const form = event.context.scoped.getComponentById("instance_form");
17187
17230
  return form.validate().then((instanceFormValidate)=>{
17188
17231
  event.setData({...event.data, instanceFormValidate})
@@ -17242,7 +17285,6 @@ const getSubmitActions = async (instance) => {
17242
17285
  };
17243
17286
 
17244
17287
  const getApprovalDrawerSchema = async (instance) => {
17245
- console.log("=============getApprovalDrawerSchema=============", instance);
17246
17288
  return {
17247
17289
  type: "drawer",
17248
17290
  overlay: false,
@@ -17960,12 +18002,15 @@ const getFieldEditTpl = async (field, label)=>{
17960
18002
  // }
17961
18003
  // break;
17962
18004
  case "table":
17963
- tpl.type = "steedos-input-table"; //TODO
18005
+ tpl.type = "steedos-input-table";
17964
18006
  tpl.addable = field.permission === "editable";
17965
18007
  tpl.editable = tpl.addable;
17966
18008
  tpl.copyable = tpl.addable;
17967
18009
  tpl.removable = tpl.addable;
17968
18010
  tpl.fields = [];
18011
+ if(tpl.editable){
18012
+ tpl.className = `${tpl.className || ''} steedos-input-table-editable`;
18013
+ }
17969
18014
  for (const sField of field.fields) {
17970
18015
  if (sField.type != "hidden") {
17971
18016
  sField.permission = field.permission;
@@ -17992,7 +18037,6 @@ const getFieldEditTpl = async (field, label)=>{
17992
18037
  };
17993
18038
 
17994
18039
  const getFieldReadonlyTpl = async (field, label)=>{
17995
- // console.log(`getFieldReadonlyTpl`, label, field)
17996
18040
  const tpl = {
17997
18041
  label: label === true ? field.name : false,
17998
18042
  name: field.code,
@@ -18059,6 +18103,11 @@ const getFieldReadonlyTpl = async (field, label)=>{
18059
18103
  }
18060
18104
  }else if(field.type === 'html'){
18061
18105
  tpl.type = 'tpl';
18106
+ }else if(field.type.startsWith("sfield-") || field.type === 'steedos-field'){
18107
+ tpl.type = 'steedos-field';
18108
+ tpl.config = field.steedos_field || field.config;
18109
+ tpl.static = true;
18110
+ tpl.inInputTable = true;
18062
18111
  }
18063
18112
  else {
18064
18113
  tpl.type = 'static';
@@ -18073,6 +18122,9 @@ const getFieldReadonlyTpl = async (field, label)=>{
18073
18122
  * @returns
18074
18123
  */
18075
18124
  const getTdInputTpl = async (field, label) => {
18125
+ if(field.config?.amis?.name){
18126
+ delete field.config.amis.name;
18127
+ }
18076
18128
  const edit = field.permission === "editable";
18077
18129
  if(edit){
18078
18130
  return await getFieldEditTpl(field, label)
@@ -18190,7 +18242,6 @@ const getFormTableView = async (instance) => {
18190
18242
  trs: await getFormTrs(instance),
18191
18243
  id: "u:047f3669468b",
18192
18244
  };
18193
- console.log('getFormTableView===>', instance, formSchema);
18194
18245
  return formSchema;
18195
18246
  };
18196
18247
 
@@ -18721,7 +18772,6 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18721
18772
 
18722
18773
 
18723
18774
  const getInstanceInfo = async (props) => {
18724
- console.log(`getInstanceInfo props`, props);
18725
18775
  const { instanceId, box } = props;
18726
18776
  const userId = amisLib.getSteedosAuth().userId;
18727
18777
  const query = `{
@@ -18805,7 +18855,6 @@ const getInstanceInfo = async (props) => {
18805
18855
  });
18806
18856
 
18807
18857
  const moment = getMoment();
18808
- console.log('getInstanceInfo====>', step, formVersion.fields);
18809
18858
  return {
18810
18859
  box: box,
18811
18860
  _id: instanceId,