@steedos-widgets/amis-lib 6.10.31 → 6.10.33

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
@@ -10530,7 +10530,7 @@ function formatUISchemaCache(objectName, uiSchema){
10530
10530
  });
10531
10531
  }
10532
10532
 
10533
- async function getUISchema(objectName, force, retry = true) {
10533
+ async function getUISchema(objectName, force = false, retry = true) {
10534
10534
  if (!objectName) {
10535
10535
  return;
10536
10536
  }
@@ -17743,7 +17743,7 @@ const getApprovalDrawerSchema = async (instance, events) => {
17743
17743
  },
17744
17744
  ]
17745
17745
  };
17746
- console.log(`getApprovalDrawerSchema: `, schema);
17746
+ // console.log(`getApprovalDrawerSchema: `, schema)
17747
17747
  return schema;
17748
17748
  };
17749
17749
 
@@ -17980,14 +17980,122 @@ const getInstanceApprovalHistory = async ()=>{
17980
17980
  }
17981
17981
  };
17982
17982
 
17983
- /*
17984
- * @Author: baozhoutao@steedos.com
17985
- * @Date: 2022-09-07 16:20:45
17986
- * @LastEditors: yinlianghui yinlianghui@hotoa.com
17987
- * @LastEditTime: 2025-12-09 16:06:24
17988
- * @Description:
17989
- */
17990
-
17983
+ const getStepsSchema = (instance) => {
17984
+ if(instance.box === 'draft' && instance.state === 'draft' && instance.flow.allow_select_step){
17985
+ const schema = {
17986
+ "type": "service",
17987
+ "id": "u:set_steps_users",
17988
+ "api": {
17989
+ "url": "/api/workflow/v2/nextSteps",
17990
+ "method": "post",
17991
+ "requestAdaptor": `
17992
+ const ctx = api.data.context;
17993
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
17994
+ api.data = {
17995
+ flowVersionId: ctx.flowVersion._id,
17996
+ instanceId: ctx._id,
17997
+ flowId: ctx.flow._id,
17998
+ step: ctx.step,
17999
+ values: formValues
18000
+ };
18001
+ return api;
18002
+ `,
18003
+ "adaptor": `
18004
+ payload.stepIds = _.map(payload.nextSteps, '_id');
18005
+ return payload;
18006
+ `
18007
+ }
18008
+ ,
18009
+ "body": [
18010
+ {
18011
+ "type": "table2",
18012
+ "source": "$nextSteps",
18013
+ "className": "set-next-steps-users my-4",
18014
+ "label": false,
18015
+ "needConfirm": false,
18016
+ "bordered": true,
18017
+ "title": "审批步骤",
18018
+ "quickSaveItemApi": {
18019
+ "url": "/api/workflow/v2/set_instance_steps",
18020
+ "method": "post",
18021
+ "requestAdaptor": `
18022
+ if(event && false){
18023
+ api.data = {
18024
+ instanceId: 'none'
18025
+ }
18026
+ }else{
18027
+ const ctx = api.data.context;
18028
+ api.data = {
18029
+ instanceId: ctx._id,
18030
+ stepId: context._id,
18031
+ selected: context.selected,
18032
+ handler: context.stepHandler
18033
+ };
18034
+ }
18035
+
18036
+ return api;
18037
+ `,
18038
+ "adaptor": `
18039
+ payload.stepIds = _.map(payload.nextSteps, '_id');
18040
+ return payload;
18041
+ `
18042
+ },
18043
+ // "rowSelection": {
18044
+ // "type": "checkbox",
18045
+ // "keyField": "id",
18046
+ // "checked": true,
18047
+ // "selected": true,
18048
+ // // "disableOn": "${allow_skip != true}",
18049
+ // "selectedRowKeysExpr": "${ARRAYINCLUDES(stepIds, id)}"
18050
+ // },
18051
+ "columns": [
18052
+ {
18053
+ "label": "选择",
18054
+ "name": "selected",
18055
+ "width": 50,
18056
+ "quickEdit": {
18057
+ "type": "checkbox",
18058
+ "mode": "inline",
18059
+ "id": "selected",
18060
+ "name": "selected",
18061
+ "saveImmediately": true,
18062
+ "value": true,
18063
+ "disabledOn": "${allow_skip != true}",
18064
+ }
18065
+ },
18066
+ {
18067
+ "label": "步骤名称",
18068
+ "name": "name",
18069
+ "quickEdit": false
18070
+ },
18071
+ {
18072
+ "label": "处理人",
18073
+ "name": "stepHandler",
18074
+ "quickEdit": {
18075
+ "type": "steedos-instance-handler",
18076
+ "mode": "inline",
18077
+ "id": "stepHandler",
18078
+ "name": "stepHandler",
18079
+ "saveImmediately": true
18080
+ }
18081
+ },
18082
+ // {
18083
+ // "label": "操作",
18084
+ // "name": "actions"
18085
+ // }
18086
+ ]
18087
+ }
18088
+ ]
18089
+ };
18090
+ return schema;
18091
+ }else {
18092
+ return {
18093
+ type: 'tpl',
18094
+ id: "u:set_steps_users",
18095
+ tpl: ''
18096
+ }
18097
+ }
18098
+ };
17991
18099
 
17992
18100
  const getSelectOptions = (field) => {
17993
18101
  const options = [];
@@ -18933,7 +19041,7 @@ const getApproveButton = async (instance, events)=>{
18933
19041
  var instancePageContent = document.querySelector(".steedos-amis-instance-view .antd-Page-content");
18934
19042
  var approvalDrawerContent = document.querySelector(".approval-drawer .antd-Drawer-content");
18935
19043
  if (instancePageContent && approvalDrawerContent) {
18936
- $(instancePageContent).css("paddingBottom", `${approvalDrawerContent.clientHeight + 10}px`);
19044
+ $(instancePageContent).css("paddingBottom", `${approvalDrawerContent.clientHeight + 2}px`);
18937
19045
  }
18938
19046
  }
18939
19047
  }
@@ -19074,8 +19182,12 @@ const getFlowFormSchema = async (instance, box) => {
19074
19182
  "font-size": "14px",
19075
19183
  "font-weight": "500"
19076
19184
  },
19077
- ".steedos-amis-instance-view.steedos-instance-style-table .antd-Page-body": {
19078
- "width": "1024px"
19185
+ ".steedos-amis-instance-view.steedos-instance-style-table .antd-Page-body .steedos-amis-instance-view-content": {
19186
+ "max-width": "1024px"
19187
+ },
19188
+ ".steedos-amis-instance-view .approval-drawer.antd-Drawer .antd-Drawer-content": {
19189
+ "box-shadow": "none",
19190
+ "border-top": "1px solid rgb(209 213 219)"
19079
19191
  },
19080
19192
  ".antd-List-placeholder": {
19081
19193
  "display": "none"
@@ -19094,66 +19206,77 @@ const getFlowFormSchema = async (instance, box) => {
19094
19206
  "background": "transparent !important"
19095
19207
  }
19096
19208
  },
19097
- body: [
19098
- await getAttachments(instance),
19099
- await getRelatedInstances(),
19100
- await getRelatedRecords(instance),
19101
- {
19102
- type: "form",
19103
- debug: false,
19104
- wrapWithPanel: false,
19105
- resetAfterSubmit: true,
19106
- body: [
19107
- {
19108
- type: "tpl",
19109
- id: "u:f5bb0ad602a6",
19110
- tpl: `<div class="instance-name">${instance.title}</div>`,
19111
- inline: true,
19112
- wrapperComponent: "",
19113
- style: {
19114
- fontFamily: "",
19115
- fontSize: 12,
19116
- textAlign: "center",
19117
- },
19118
- },
19119
- formContentSchema,
19120
- await getApplicantTableView(instance),
19121
- ],
19122
- id: "instance_form",
19123
- onEvent: {
19124
- // validateError: {
19125
- // weight: 0,
19126
- // actions: [
19127
- // {
19128
- // "componentId": "",
19129
- // "args": {
19130
- // "msgType": "info",
19131
- // "position": "top-right",
19132
- // "closeButton": true,
19133
- // "showIcon": true,
19134
- // "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
19135
- // "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
19136
- // },
19137
- // "actionType": "toast"
19138
- // }
19139
- // ],
19140
- // },
19141
- change: {
19142
- weight: 0,
19143
- actions: [
19144
- {
19145
- "actionType": "reload",
19146
- "componentId": "u:next_step",
19147
- "args": {}
19209
+ body: [{
19210
+ "type": "wrapper",
19211
+ "body": [
19212
+ await getAttachments(instance),
19213
+ await getRelatedInstances(),
19214
+ await getRelatedRecords(instance),
19215
+ {
19216
+ type: "form",
19217
+ debug: false,
19218
+ wrapWithPanel: false,
19219
+ resetAfterSubmit: true,
19220
+ body: [
19221
+ {
19222
+ type: "tpl",
19223
+ id: "u:f5bb0ad602a6",
19224
+ tpl: `<div class="instance-name">${instance.title}</div>`,
19225
+ inline: true,
19226
+ wrapperComponent: "",
19227
+ style: {
19228
+ fontFamily: "",
19229
+ fontSize: 12,
19230
+ textAlign: "center",
19148
19231
  },
19149
- ...changeEvents
19150
- ]
19232
+ },
19233
+ formContentSchema,
19234
+ await getApplicantTableView(instance),
19235
+ ],
19236
+ id: "instance_form",
19237
+ onEvent: {
19238
+ // validateError: {
19239
+ // weight: 0,
19240
+ // actions: [
19241
+ // {
19242
+ // "componentId": "",
19243
+ // "args": {
19244
+ // "msgType": "info",
19245
+ // "position": "top-right",
19246
+ // "closeButton": true,
19247
+ // "showIcon": true,
19248
+ // "title": i18next.t('frontend_workflow_submit_validate_error_title'),//"提交失败",
19249
+ // "msg": i18next.t('frontend_workflow_submit_validate_error_msg'),//"请填写必填字段"
19250
+ // },
19251
+ // "actionType": "toast"
19252
+ // }
19253
+ // ],
19254
+ // },
19255
+ change: {
19256
+ weight: 0,
19257
+ actions: [
19258
+ {
19259
+ "actionType": "reload",
19260
+ "componentId": "u:next_step",
19261
+ "args": {}
19262
+ },
19263
+ {
19264
+ "actionType": "reload",
19265
+ "componentId": "u:set_steps_users",
19266
+ "args": {}
19267
+ },
19268
+ ...changeEvents
19269
+ ]
19270
+ }
19151
19271
  }
19152
- }
19153
- },
19154
- await getInstanceApprovalHistory(),
19155
- await getApproveButton(instance, { submitEvents , nextStepInitedEvents, nextStepChangeEvents, nextStepUserChangeEvents})
19156
- ],
19272
+ },
19273
+ await getStepsSchema(instance),
19274
+ await getInstanceApprovalHistory(),
19275
+ await getApproveButton(instance, { submitEvents , nextStepInitedEvents, nextStepChangeEvents, nextStepUserChangeEvents})
19276
+ ],
19277
+ "size": "none",
19278
+ "className": "steedos-amis-instance-view-content"
19279
+ }],
19157
19280
  id: "u:instancePage",
19158
19281
  messages: {},
19159
19282
  pullRefresh: {},
@@ -19416,7 +19539,8 @@ const getInstanceInfo = async (props) => {
19416
19539
  flow:flow__expand{
19417
19540
  _id,
19418
19541
  name,
19419
- perms
19542
+ perms,
19543
+ allow_select_step
19420
19544
  }
19421
19545
  }
19422
19546
  }