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

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.esm.js CHANGED
@@ -16919,6 +16919,13 @@ const getNextStepInput = async (instance) => {
16919
16919
  return api;
16920
16920
  `,
16921
16921
  "adaptor": `
16922
+ if(payload.error){
16923
+ SteedosUI.notification.error({message: payload.error});
16924
+ return {
16925
+ status: 0,
16926
+ data: {}
16927
+ }
16928
+ }
16922
16929
  payload.data = {
16923
16930
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
16924
16931
  options: _.map(payload.nextSteps, (item)=>{
@@ -16996,53 +17003,95 @@ const getNextStepUsersInput = async (instance) => {
16996
17003
  },
16997
17004
  {
16998
17005
  body: [
16999
- // TODO 处理下一步处理人默认值
17000
- Object.assign({},
17001
- {
17002
- "type": "steedos-select-user"
17003
- },
17004
17006
  {
17007
+ type: "steedos-select-user",
17008
+ label: "",
17005
17009
  name: "next_users",
17006
17010
  hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
17007
17011
  required: true
17008
- }),
17012
+ },
17009
17013
  {
17010
- type: "steedos-select-user",
17014
+ type: "list-select",
17011
17015
  label: "",
17012
17016
  name: "next_users",
17013
17017
  id: "u:next_users",
17014
17018
  required: true,
17015
17019
  hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
17016
- amis: {
17017
- multiple: "this.new_next_step.deal_type === 'counterSign'",
17018
- "source": {
17019
- "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
17020
- "method": "post",
17021
- "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17022
- "headers": {
17023
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17024
- },
17025
- "messages": {
17026
- },
17027
- "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;",
17028
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17029
- "data": {
17030
- "&": "$$",
17031
- "$scopeId": "$scopeId",
17032
- "context": "${context}",
17033
- "next_step": "${new_next_step}",
17034
- }
17020
+ multiple: "this.new_next_step.deal_type === 'counterSign'",
17021
+ "source": {
17022
+ "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers?next_step=${next_step}",
17023
+ "method": "post",
17024
+ "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17025
+ "headers": {
17026
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17035
17027
  },
17036
- "labelField": "name",
17037
- "valueField": "id",
17038
- }
17039
- }
17028
+ "messages": {
17029
+ },
17030
+ "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;",
17031
+ "adaptor": `
17032
+ if(payload.error){
17033
+ SteedosUI.notification.error({message: payload.error});
17034
+ return {
17035
+ status: 0,
17036
+ data: {}
17037
+ }
17038
+ }
17039
+ payload.data = {
17040
+ value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null,
17041
+ options: payload.nextStepUsers
17042
+ };
17043
+ return payload;`,
17044
+ "data": {
17045
+ "&": "$$",
17046
+ "$scopeId": "$scopeId",
17047
+ "context": "${context}",
17048
+ "next_step": "${new_next_step}",
17049
+ }
17050
+ },
17051
+ "labelField": "name",
17052
+ "valueField": "id",
17053
+ value: '${new_next_step.approver_users}',
17054
+ "joinValues": false,
17055
+ "extractValue": true,
17056
+ },
17057
+ // {
17058
+ // type: "steedos-select-user",
17059
+ // label: "",
17060
+ // name: "next_users",
17061
+ // id: "u:next_users",
17062
+ // required: true,
17063
+ // hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
17064
+ // amis: {
17065
+ // multiple: "this.new_next_step.deal_type === 'counterSign'",
17066
+ // "source": {
17067
+ // "url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
17068
+ // "method": "post",
17069
+ // "sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
17070
+ // "headers": {
17071
+ // "Authorization": "Bearer ${context.tenantId},${context.authToken}"
17072
+ // },
17073
+ // "messages": {
17074
+ // },
17075
+ // "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;",
17076
+ // "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17077
+ // "data": {
17078
+ // "&": "$$",
17079
+ // "$scopeId": "$scopeId",
17080
+ // "context": "${context}",
17081
+ // "next_step": "${new_next_step}",
17082
+ // }
17083
+ // },
17084
+ // "labelField": "name",
17085
+ // "valueField": "id",
17086
+ // value: '${new_next_step.approver_users}',
17087
+ // }
17088
+ // }
17040
17089
  ],
17041
17090
  id: "u:81a4913c61cc",
17042
17091
  },
17043
17092
  ],
17044
17093
  id: "u:ffff15b76c89",
17045
- className: "b-a b-1x p-xs m-b-none m-l-none m-r-none m-t-sm",
17094
+ 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' : ''}",
17046
17095
  subFormMode: "",
17047
17096
  hiddenOn: "!!!this.new_next_step || (this.new_next_step && this.new_next_step.step_type === 'end')"
17048
17097
  };
@@ -17082,14 +17131,13 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17082
17131
  _id: "${instance.approve._id}",
17083
17132
  next_steps: [{
17084
17133
  step: approveValues.next_step,
17085
- users: nextUsers,
17134
+ users: nextUsers || [],
17086
17135
  }],
17087
17136
  description: approveValues.suggestion,
17088
17137
  values: formValues
17089
17138
  }]
17090
17139
  }]
17091
17140
  }]};
17092
- console.log('submit api', api);
17093
17141
  api.data = body;
17094
17142
  return api;
17095
17143
  `;
@@ -17110,7 +17158,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17110
17158
  _id: "${instance.approve._id}",
17111
17159
  next_steps: [{
17112
17160
  step: approveValues.next_step,
17113
- users: nextUsers,
17161
+ users: nextUsers || [],
17114
17162
  }],
17115
17163
  description: approveValues.suggestion,
17116
17164
  values: formValues
@@ -17128,7 +17176,6 @@ const getPostEngineRequestAdaptor = async (instance) => {
17128
17176
  * @returns
17129
17177
  */
17130
17178
  const getSubmitActions = async (instance) => {
17131
- console.log(`getSubmitActions instance====`, instance);
17132
17179
  let api = "";
17133
17180
  let requestAdaptor = "";
17134
17181
  if(instance.approve?.type == "cc"){
@@ -17145,9 +17192,6 @@ const getSubmitActions = async (instance) => {
17145
17192
  return null; //TODO 考虑异常情况?
17146
17193
  }
17147
17194
  }
17148
- console.log(`getSubmitActions api====`, api);
17149
- console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
17150
- console.log('getObjectListViewPath========>', Router$1.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
17151
17195
  return [
17152
17196
  // 校验表单
17153
17197
  {
@@ -17155,7 +17199,6 @@ const getSubmitActions = async (instance) => {
17155
17199
  "args": {},
17156
17200
  "actionType": "custom",
17157
17201
  "script": `
17158
- console.log("======getSubmitActions");
17159
17202
  const form = event.context.scoped.getComponentById("instance_form");
17160
17203
  return form.validate().then((instanceFormValidate)=>{
17161
17204
  event.setData({...event.data, instanceFormValidate})
@@ -17215,7 +17258,6 @@ const getSubmitActions = async (instance) => {
17215
17258
  };
17216
17259
 
17217
17260
  const getApprovalDrawerSchema = async (instance) => {
17218
- console.log("=============getApprovalDrawerSchema=============", instance);
17219
17261
  return {
17220
17262
  type: "drawer",
17221
17263
  overlay: false,
@@ -17933,12 +17975,15 @@ const getFieldEditTpl = async (field, label)=>{
17933
17975
  // }
17934
17976
  // break;
17935
17977
  case "table":
17936
- tpl.type = "steedos-input-table"; //TODO
17978
+ tpl.type = "steedos-input-table";
17937
17979
  tpl.addable = field.permission === "editable";
17938
17980
  tpl.editable = tpl.addable;
17939
17981
  tpl.copyable = tpl.addable;
17940
17982
  tpl.removable = tpl.addable;
17941
17983
  tpl.fields = [];
17984
+ if(tpl.editable){
17985
+ tpl.className = `${tpl.className || ''} steedos-input-table-editable`;
17986
+ }
17942
17987
  for (const sField of field.fields) {
17943
17988
  if (sField.type != "hidden") {
17944
17989
  sField.permission = field.permission;
@@ -17965,7 +18010,6 @@ const getFieldEditTpl = async (field, label)=>{
17965
18010
  };
17966
18011
 
17967
18012
  const getFieldReadonlyTpl = async (field, label)=>{
17968
- // console.log(`getFieldReadonlyTpl`, label, field)
17969
18013
  const tpl = {
17970
18014
  label: label === true ? field.name : false,
17971
18015
  name: field.code,
@@ -18032,6 +18076,11 @@ const getFieldReadonlyTpl = async (field, label)=>{
18032
18076
  }
18033
18077
  }else if(field.type === 'html'){
18034
18078
  tpl.type = 'tpl';
18079
+ }else if(field.type.startsWith("sfield-") || field.type === 'steedos-field'){
18080
+ tpl.type = 'steedos-field';
18081
+ tpl.config = field.steedos_field || field.config;
18082
+ tpl.static = true;
18083
+ tpl.inInputTable = true;
18035
18084
  }
18036
18085
  else {
18037
18086
  tpl.type = 'static';
@@ -18046,6 +18095,9 @@ const getFieldReadonlyTpl = async (field, label)=>{
18046
18095
  * @returns
18047
18096
  */
18048
18097
  const getTdInputTpl = async (field, label) => {
18098
+ if(field.config?.amis?.name){
18099
+ delete field.config.amis.name;
18100
+ }
18049
18101
  const edit = field.permission === "editable";
18050
18102
  if(edit){
18051
18103
  return await getFieldEditTpl(field, label)
@@ -18163,7 +18215,6 @@ const getFormTableView = async (instance) => {
18163
18215
  trs: await getFormTrs(instance),
18164
18216
  id: "u:047f3669468b",
18165
18217
  };
18166
- console.log('getFormTableView===>', instance, formSchema);
18167
18218
  return formSchema;
18168
18219
  };
18169
18220
 
@@ -18694,7 +18745,6 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18694
18745
 
18695
18746
 
18696
18747
  const getInstanceInfo = async (props) => {
18697
- console.log(`getInstanceInfo props`, props);
18698
18748
  const { instanceId, box } = props;
18699
18749
  const userId = getSteedosAuth$1().userId;
18700
18750
  const query = `{
@@ -18778,7 +18828,6 @@ const getInstanceInfo = async (props) => {
18778
18828
  });
18779
18829
 
18780
18830
  const moment = getMoment();
18781
- console.log('getInstanceInfo====>', step, formVersion.fields);
18782
18831
  return {
18783
18832
  box: box,
18784
18833
  _id: instanceId,