@steedos-widgets/amis-lib 6.10.1-beta.33 → 6.10.1-beta.34

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
@@ -10386,7 +10386,10 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10386
10386
  data: {
10387
10387
  relatedKey: relatedKey,
10388
10388
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
10389
- _isRelated: true
10389
+ _isRelated: true,
10390
+ record: {
10391
+ recordPermissions: relatedObjectUiSchema.permissions
10392
+ }
10390
10393
  },
10391
10394
  body:[
10392
10395
  amisSchema
@@ -16820,6 +16823,7 @@ const getJudgeOptions = async (instance) => {
16820
16823
 
16821
16824
  const getJudgeInput = async (instance) => {
16822
16825
  const judgeOptions = await getJudgeOptions(instance);
16826
+ // console.log('getJudgeInput', judgeOptions);
16823
16827
  if (judgeOptions.length > 0 && instance.approve.type != 'cc') {
16824
16828
  return {
16825
16829
  type: "radios",
@@ -16860,6 +16864,7 @@ const getJudgeInput = async (instance) => {
16860
16864
 
16861
16865
  //TODO 只有一个下一步时,默认选中,并且禁止修改.
16862
16866
  const getNextStepInput = async (instance) => {
16867
+ // console.log('getNextStepInput', instance);
16863
16868
  if(instance.approve?.type == 'cc'){
16864
16869
  return ;
16865
16870
  }
@@ -16895,14 +16900,30 @@ const getNextStepInput = async (instance) => {
16895
16900
  "next_users": null
16896
16901
  },
16897
16902
  "source": {
16898
- "url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
16903
+ "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
16899
16904
  "headers": {
16900
16905
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
16901
16906
  },
16902
16907
  "method": "post",
16903
16908
  "messages": {
16904
16909
  },
16905
- "requestAdaptor": "let { context, judge } = api.data; if(!judge){judge='approved'}\nconst formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\nflowVersionId: context.flowVersion._id,\n instanceId: context._id,\n flowId: context.flow._id,\n step: context.step,\n judge: judge,\n values: formValues\n}\n\n\n return api;",
16910
+ "requestAdaptor": `
16911
+ let { judge } = api.data;
16912
+ const ctx = api.data.context;
16913
+ if(!judge){
16914
+ judge='approved'
16915
+ };
16916
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
16917
+ api.data = {
16918
+ flowVersionId: ctx.flowVersion._id,
16919
+ instanceId: ctx._id,
16920
+ flowId: ctx.flow._id,
16921
+ step: ctx.step,
16922
+ judge: judge,
16923
+ values: formValues
16924
+ };
16925
+ return api;
16926
+ `,
16906
16927
  "adaptor": `
16907
16928
  payload.data = {
16908
16929
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
@@ -17010,7 +17031,7 @@ const getNextStepUsersInput = async (instance) => {
17010
17031
  "messages": {
17011
17032
  },
17012
17033
  "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;",
17013
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17034
+ "adaptor": "debugger;\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17014
17035
  "data": {
17015
17036
  "&": "$$",
17016
17037
  "$scopeId": "$scopeId",
@@ -17035,8 +17056,8 @@ const getNextStepUsersInput = async (instance) => {
17035
17056
 
17036
17057
  const getCCSubmitRequestAdaptor = async (instance) => {
17037
17058
  return `
17038
- const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17039
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17059
+ const instanceForm = context._scoped.getComponentById("instance_form");
17060
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17040
17061
  api.data = {
17041
17062
  instanceId: "${instance._id}",
17042
17063
  traceId: "${instance.trace._id}",
@@ -17048,9 +17069,9 @@ const getCCSubmitRequestAdaptor = async (instance) => {
17048
17069
  };
17049
17070
 
17050
17071
  const getPostSubmitRequestAdaptor = async (instance) => {
17051
- return ` const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17072
+ return ` const instanceForm = context._scoped.getComponentById("instance_form");
17052
17073
  const formValues = instanceForm.getValues();
17053
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17074
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17054
17075
  let nextUsers = approveValues.next_users;
17055
17076
  if(_.isString(nextUsers)){
17056
17077
  nextUsers = [approveValues.next_users];
@@ -17066,7 +17087,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17066
17087
  approves: [{
17067
17088
  _id: "${instance.approve._id}",
17068
17089
  next_steps: [{
17069
- step: approveValues.next_step._id,
17090
+ step: approveValues.next_step,
17070
17091
  users: nextUsers,
17071
17092
  }],
17072
17093
  description: approveValues.suggestion,
@@ -17074,6 +17095,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17074
17095
  }]
17075
17096
  }]
17076
17097
  }]};
17098
+ console.log('submit api', api);
17077
17099
  api.data = body;
17078
17100
  return api;
17079
17101
  `;
@@ -17081,8 +17103,8 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17081
17103
 
17082
17104
  const getPostEngineRequestAdaptor = async (instance) => {
17083
17105
  return `
17084
- const formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form").getValues();
17085
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17106
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
17107
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17086
17108
  let nextUsers = approveValues.next_users;
17087
17109
  if(_.isString(nextUsers)){
17088
17110
  nextUsers = [approveValues.next_users];
@@ -17093,7 +17115,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17093
17115
  trace: "${instance.approve.trace}",
17094
17116
  _id: "${instance.approve._id}",
17095
17117
  next_steps: [{
17096
- step: approveValues.next_step._id,
17118
+ step: approveValues.next_step,
17097
17119
  users: nextUsers,
17098
17120
  }],
17099
17121
  description: approveValues.suggestion,
@@ -17112,7 +17134,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17112
17134
  * @returns
17113
17135
  */
17114
17136
  const getSubmitActions = async (instance) => {
17115
- // console.log(`getSubmitActions instance====`, instance)
17137
+ console.log(`getSubmitActions instance====`, instance);
17116
17138
  let api = "";
17117
17139
  let requestAdaptor = "";
17118
17140
  if(instance.approve?.type == "cc"){
@@ -17129,7 +17151,9 @@ const getSubmitActions = async (instance) => {
17129
17151
  return null; //TODO 考虑异常情况?
17130
17152
  }
17131
17153
  }
17132
-
17154
+ console.log(`getSubmitActions api====`, api);
17155
+ console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
17156
+ console.log('getObjectListViewPath========>', amisLib.Router.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
17133
17157
  return [
17134
17158
  // 校验表单
17135
17159
  {
@@ -17137,7 +17161,7 @@ const getSubmitActions = async (instance) => {
17137
17161
  "args": {},
17138
17162
  "actionType": "custom",
17139
17163
  "script": `
17140
- // console.log("======getSubmitActions");
17164
+ console.log("======getSubmitActions");
17141
17165
  const form = event.context.scoped.getComponentById("instance_form");
17142
17166
  return form.validate().then((instanceFormValidate)=>{
17143
17167
  event.setData({...event.data, instanceFormValidate})
@@ -17161,7 +17185,7 @@ const getSubmitActions = async (instance) => {
17161
17185
  componentId: "",
17162
17186
  args: {
17163
17187
  api: {
17164
- url: `\${context.rootUrl}${api}`,
17188
+ url: `${api}`,
17165
17189
  method: "post",
17166
17190
  dataType: "json",
17167
17191
  data: {
@@ -17197,7 +17221,7 @@ const getSubmitActions = async (instance) => {
17197
17221
  };
17198
17222
 
17199
17223
  const getApprovalDrawerSchema = async (instance) => {
17200
- // console.log("=============getApprovalDrawerSchema=============")
17224
+ console.log("=============getApprovalDrawerSchema=============", instance);
17201
17225
  return {
17202
17226
  type: "drawer",
17203
17227
  overlay: true,
@@ -17211,7 +17235,7 @@ const getApprovalDrawerSchema = async (instance) => {
17211
17235
  bodyClassName: 'p-2',
17212
17236
  footerClassName: 'p-2 pt-0',
17213
17237
  drawerContainer: ()=>{
17214
- return window.$(".antd-Page-content",window.$(".steedos-instance-wrapper"))[0];
17238
+ return document.body;
17215
17239
  },
17216
17240
  body: [
17217
17241
  {
@@ -17360,15 +17384,11 @@ const getAttachments = async (instance)=>{
17360
17384
  {
17361
17385
  type: 'tpl',
17362
17386
  inline: true,
17363
- tpl: `<a href='\${context.rootUrl}/api/files/instances/\${_id}?download=true' target='_blank'>\${original.name}</a>`
17387
+ tpl: `<a href='/api/v6/files/download/cfs.instances.filerecord/\${_id}/\${original.name}?download=true' target='_blank'>\${original.name}</a>`
17364
17388
  }
17365
17389
  ],
17366
17390
  "actions": [
17367
- {
17368
- "icon": "fa fa-eye",
17369
- "type": "button",
17370
- "id": "u:ef52fa8940a8"
17371
- }
17391
+
17372
17392
  ],
17373
17393
  "id": "u:550b3fdc8788"
17374
17394
  },
@@ -17414,7 +17434,7 @@ const getAttachmentUploadInput = async (instance)=>{
17414
17434
  "extractValue": false,
17415
17435
  "valueField": "version_id",
17416
17436
  "receiver": {
17417
- "url": "${context.rootUrl}/api/v4/instances/s3",
17437
+ "url": "/api/instance/${context._id}/file",
17418
17438
  headers: {
17419
17439
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
17420
17440
  },
@@ -17426,7 +17446,7 @@ const getAttachmentUploadInput = async (instance)=>{
17426
17446
  api.data.append('instance', '${instance._id}');
17427
17447
  api.data.append('approve', '${instance.approve?._id}');
17428
17448
  api.data.append('owner', '${auth.userId}');
17429
- api.data.append('owner_name', '${auth.name}');
17449
+ api.data.append('owner_name', '${auth.user.name}');
17430
17450
  return api;
17431
17451
  `
17432
17452
  },
@@ -17505,11 +17525,6 @@ const getRelatedInstances = async (instance)=>{
17505
17525
  }
17506
17526
  ],
17507
17527
  "actions": [
17508
- {
17509
- "icon": "fa fa-eye",
17510
- "type": "button",
17511
- "id": "u:ef52fa8940a8"
17512
- }
17513
17528
  ],
17514
17529
  "id": "u:550b3fdc8788"
17515
17530
  },
@@ -18280,6 +18295,7 @@ const getFlowFormSchema = async (instance, box) => {
18280
18295
  name: "instancePage",
18281
18296
  className: "steedos-amis-instance-view",
18282
18297
  bodyClassName: "overflow-y-auto h-full",
18298
+ headerClassName: "p-0",
18283
18299
  "title": {
18284
18300
  "type": "steedos-record-detail-header",
18285
18301
  "label": "标题面板",
@@ -18301,6 +18317,25 @@ const getFlowFormSchema = async (instance, box) => {
18301
18317
  ".antd-List-heading": {
18302
18318
  "font-size": "14px",
18303
18319
  "font-weight": "500"
18320
+ },
18321
+ ".steedos-object-record-detail-header .antd-Grid-col--mdAuto": {
18322
+ "padding": "0px !important"
18323
+ },
18324
+ ".steedos-amis-instance-view .antd-Page-body": {
18325
+ "width": "710px"
18326
+ },
18327
+ ".antd-List-placeholder": {
18328
+ "display": "none"
18329
+ },
18330
+ ".steedos-amis-instance-view .antd-Table-fixedTop:after":{
18331
+ "box-shadow": "none"
18332
+ },
18333
+ ".antd-List-items": {
18334
+ "border": '0px'
18335
+ },
18336
+ ".antd-ListItem": {
18337
+ "border-top": "0px !important",
18338
+ "background": "transparent !important"
18304
18339
  }
18305
18340
  },
18306
18341
  body: [
@@ -18645,7 +18680,9 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18645
18680
  return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
18646
18681
  };
18647
18682
 
18648
- const getInstanceInfo = async ({ instanceId, box }) => {
18683
+ const getInstanceInfo = async (props) => {
18684
+ console.log(`getInstanceInfo props`, props);
18685
+ const { instanceId, box } = props;
18649
18686
  const userId = amisLib.getSteedosAuth().userId;
18650
18687
  const query = `{
18651
18688
  instance: instances__findOne(id:"${instanceId}"){