@steedos-widgets/amis-object 1.2.35-beta.1 → 1.2.35

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.
@@ -1,4 +1,4 @@
1
- import './AmisSelectFlow.less';
1
+ import "./AmisSelectFlow.less";
2
2
  /**
3
3
  *
4
4
  * @css
@@ -3794,9 +3794,10 @@ async function getFieldTpl (field, options){
3794
3794
  }
3795
3795
  }
3796
3796
 
3797
- async function getFieldsTemplate(fields, expand){
3798
- if(expand != false){
3799
- expand = true;
3797
+ async function getFieldsTemplate(fields, display){
3798
+ let expandFields = [];
3799
+ if(display != false){
3800
+ display = true;
3800
3801
  }
3801
3802
  let fieldsName = ['_id'];
3802
3803
  let displayFields = [];
@@ -3808,33 +3809,43 @@ async function getFieldsTemplate(fields, expand){
3808
3809
  }
3809
3810
  for (const field of fieldsArr) {
3810
3811
  //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
3811
- if(field.name.indexOf('.') < 0){
3812
- if(expand && (field.type == 'lookup' || field.type == 'master_detail')){
3813
- fieldsName.push(`${field.name}`);
3814
- displayFields.push(`${field.name}`);
3812
+ if(field.expand){
3813
+ expandFields.push(field);
3814
+ }else {
3815
+ if(field.name.indexOf('.') < 0){
3816
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
3817
+ fieldsName.push(`${field.name}`);
3818
+ displayFields.push(`${field.name}`);
3819
+ }else {
3820
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3821
+ }
3822
+ if(___default.includes(['time','date','datetime','boolean','number','currency'], field.type)){
3823
+ fieldsName.push(`${field.name}`);
3824
+ }
3825
+ if(___default.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3826
+ displayFields.push(`${field.name}`);
3827
+ }
3815
3828
  }else {
3816
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
3817
- }
3818
- if(___default.includes(['time','date','datetime','boolean','number','currency'], field.type)){
3819
- fieldsName.push(`${field.name}`);
3820
- }
3821
- if(___default.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
3822
- displayFields.push(`${field.name}`);
3829
+ objectFieldName = field.name.split('.')[0];
3830
+ fieldsName.push(objectFieldName);
3831
+ displayFields.push(objectFieldName);
3823
3832
  }
3824
- }else {
3825
- objectFieldName = field.name.split('.')[0];
3826
- fieldsName.push(objectFieldName);
3827
- displayFields.push(objectFieldName);
3828
3833
  }
3829
3834
  }
3830
3835
 
3831
3836
  displayFields = ___default__namespace.uniq(displayFields);
3832
3837
  fieldsName = ___default__namespace.uniq(fieldsName);
3838
+ let expandFieldsQuery = "";
3839
+ if(expandFields.length > 0){
3840
+ ___default__namespace.each(expandFields, function(field){
3841
+ expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
3842
+ });
3843
+ }
3833
3844
 
3834
3845
  if(displayFields.length > 0){
3835
- return `${fieldsName.join(',')},_display:_ui{${displayFields.join(',')}}`;
3846
+ return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
3836
3847
  }
3837
- return `${fieldsName.join(' ')}`
3848
+ return `${fieldsName.join(' ')},${expandFieldsQuery}`
3838
3849
  }
3839
3850
 
3840
3851
  function getRecordPermissionsTemplate(){
@@ -6510,7 +6521,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6510
6521
  if(!event.data.isLookup){
6511
6522
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
6512
6523
  const listViewId = event.data.listViewId;
6513
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
6524
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6514
6525
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6515
6526
  if(localListViewProps){
6516
6527
  localListViewProps = JSON.parse(localListViewProps);
@@ -6542,7 +6553,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6542
6553
  searchableFieldsStoreKey += "lookup/" + objectName;
6543
6554
  }
6544
6555
  else{
6545
- searchableFieldsStoreKey += listViewId;
6556
+ searchableFieldsStoreKey += (listViewId || "");
6546
6557
  }
6547
6558
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
6548
6559
  if(defaultSearchableFields){
@@ -6569,7 +6580,9 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6569
6580
  setData({ showFieldsFilter: false });
6570
6581
  }
6571
6582
  else{
6572
- const listViewPropsStoreKey = location.pathname + "/crud/" + data.listViewId ;
6583
+ console.log("===listViewPropsStoreKey=data==", data);
6584
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
6585
+ console.log("===listViewPropsStoreKey=122==", listViewPropsStoreKey);
6573
6586
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6574
6587
  if(localListViewProps){
6575
6588
  localListViewProps = JSON.parse(localListViewProps);
@@ -6615,7 +6628,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6615
6628
  searchableFieldsStoreKey += "lookup/" + objectName;
6616
6629
  }
6617
6630
  else{
6618
- searchableFieldsStoreKey += listViewId;
6631
+ searchableFieldsStoreKey += (listViewId || "");
6619
6632
  }
6620
6633
  sessionStorage.setItem(searchableFieldsStoreKey, value);
6621
6634
 
@@ -6673,7 +6686,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6673
6686
  }
6674
6687
 
6675
6688
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
6676
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
6689
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
6677
6690
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
6678
6691
  if(localListViewProps){
6679
6692
  localListViewProps = JSON.parse(localListViewProps);
@@ -6792,7 +6805,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6792
6805
  const fields = uiSchema.fields;
6793
6806
  const options = (payload.data?.options || []).filter(function(item){
6794
6807
  let field = fields[item.value];
6795
- return !!field && window.isFieldTypeSearchable(field.type)
6808
+ // TODO: 暂时禁用location类型字段的列表搜索
6809
+ return !!field && window.isFieldTypeSearchable(field.type) && field.type !== 'location'
6796
6810
  });
6797
6811
  payload.data = {
6798
6812
  "options": options
@@ -8395,6 +8409,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8395
8409
 
8396
8410
  function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
8397
8411
  // console.log(`getObjectHeaderToolbar====>`, filterVisible)
8412
+ console.log(`getObjectHeaderToolbar`, mainObject);
8398
8413
  const isMobile = window.innerWidth < 768;
8399
8414
  if(isMobile){
8400
8415
  showDisplayAs = false;
@@ -8494,7 +8509,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
8494
8509
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
8495
8510
  },
8496
8511
  // getExportExcelToolbarButtonSchema(),
8497
- getSettingListviewToolbarButtonSchema(),
8512
+ mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
8498
8513
  getDisplayAsButton(mainObject?.name),
8499
8514
  filterVisible ? {
8500
8515
  "label": instance.t('frontend_button_search_tooltip'),
@@ -10334,12 +10349,35 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
10334
10349
  }
10335
10350
  }
10336
10351
 
10352
+ const coordinatesType = field.coordinatesType || "bd09";
10337
10353
  convertData = {
10338
10354
  type: getAmisStaticFieldType('location', readonly),
10339
10355
  tpl: readonly ? getLocationTpl(field) : null,
10340
10356
  ak,
10341
10357
  vendor,
10342
- label: field.label
10358
+ clearable: true,
10359
+ coordinatesType,
10360
+ label: field.label,
10361
+ pipeOut: (value, oldValue, data) => {
10362
+ if (value) {
10363
+ const lng = value.lng;
10364
+ const lat = value.lat;
10365
+ let coordinates = [lng,lat];
10366
+ if(window.coordtransform){
10367
+ if(coordinatesType.toLowerCase() === 'bd09'){
10368
+ const bd09togcj02 = window.coordtransform.bd09togcj02(lng,lat);
10369
+ coordinates = window.coordtransform.gcj02towgs84(bd09togcj02[0],bd09togcj02[1]);
10370
+ }else if(coordinatesType.toLowerCase() === 'gcj02'){
10371
+ coordinates = window.coordtransform.gcj02towgs84(lng,lat);
10372
+ }
10373
+ }
10374
+ value.wgs84 = {
10375
+ type: "Point",
10376
+ coordinates
10377
+ };
10378
+ return value; // 切换到数字之后的默认值
10379
+ }
10380
+ }
10343
10381
  };
10344
10382
  break;
10345
10383
  case 'avatar':
@@ -10807,6 +10845,10 @@ async function getQuickEditSchema(field, options){
10807
10845
  if(field.type == "file" && field.multiple){
10808
10846
  quickEditSchema = false;
10809
10847
  }
10848
+ //TODO:location字段在列表中快速编辑后存在bug,保存时可能会丢失部分数据,暂时禁用
10849
+ if(field.type == "location"){
10850
+ quickEditSchema = false;
10851
+ }
10810
10852
  }
10811
10853
  return quickEditSchema;
10812
10854
  }
@@ -11361,7 +11403,7 @@ async function getTableApi(mainObject, fields, options){
11361
11403
  try{
11362
11404
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11363
11405
  const listViewId = api.data.listViewId;
11364
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
11406
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11365
11407
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
11366
11408
  if(localListViewProps){
11367
11409
  localListViewProps = JSON.parse(localListViewProps);
@@ -11562,7 +11604,7 @@ async function getTableApi(mainObject, fields, options){
11562
11604
  try{
11563
11605
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
11564
11606
  const listViewId = api.body.listViewId;
11565
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
11607
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
11566
11608
  /**
11567
11609
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
11568
11610
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -13531,7 +13573,7 @@ async function getRelatedListSchema(
13531
13573
  * @Author: baozhoutao@steedos.com
13532
13574
  * @Date: 2022-07-05 15:55:39
13533
13575
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13534
- * @LastEditTime: 2023-06-04 17:36:49
13576
+ * @LastEditTime: 2023-08-01 14:50:23
13535
13577
  * @Description:
13536
13578
  */
13537
13579
 
@@ -13796,7 +13838,7 @@ async function getListSchema(
13796
13838
  * 本次存储代码段
13797
13839
  */
13798
13840
  try {
13799
- const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
13841
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (ctx.listViewId || "");
13800
13842
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
13801
13843
  /**
13802
13844
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -13865,6 +13907,7 @@ async function getListSchema(
13865
13907
  "filterVisible": ctx.filterVisible,
13866
13908
  "rowClassNameExpr": ctx.rowClassNameExpr
13867
13909
  };
13910
+ // console.log(`getListSchema===>`,amisSchema)
13868
13911
  return {
13869
13912
  uiSchema,
13870
13913
  amisSchema,
@@ -13878,7 +13921,7 @@ async function getTableSchema(
13878
13921
  columns,
13879
13922
  ctx = {}
13880
13923
  ) {
13881
- // console.time('getTableSchema');
13924
+ // console.time('getTableSchema', columns);
13882
13925
  const uiSchema = await getUISchema(objectName);
13883
13926
 
13884
13927
  let sort = ctx.sort;
@@ -13892,19 +13935,52 @@ async function getTableSchema(
13892
13935
  }
13893
13936
 
13894
13937
  let fields = [];
13895
- ___default.each(columns, function (column) {
13896
- if (___default.isString(column) && uiSchema.fields[column]) {
13897
- fields.push(uiSchema.fields[column]);
13898
- } else if (___default.isObject(column) && uiSchema.fields[column.field]) {
13899
- fields.push(
13900
- Object.assign({}, uiSchema.fields[column.field], {
13901
- width: column.width,
13902
- wrap: column.wrap, // wrap = true 是没效果的
13903
- amis: column.amis
13904
- })
13905
- );
13938
+ for(const column of columns){
13939
+ if (___default.isString(column)) {
13940
+ if(column.indexOf('.') > 0){
13941
+ const fieldName = column.split('.')[0];
13942
+ const displayName = column.split('.')[1];
13943
+ const filedInfo = uiSchema.fields[fieldName];
13944
+ if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && ___default.isString(filedInfo.reference_to) ){
13945
+ const rfUiSchema = await getUISchema(filedInfo.reference_to);
13946
+ const rfFieldInfo = rfUiSchema.fields[displayName];
13947
+ fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
13948
+ }
13949
+ }else {
13950
+ if(uiSchema.fields[column]){
13951
+ fields.push(uiSchema.fields[column]);
13952
+ }
13953
+ }
13954
+ } else if (___default.isObject(column)) {
13955
+ if(column.field.indexOf('.') > 0){
13956
+ const fieldName = column.field.split('.')[0];
13957
+ const displayName = column.field.split('.')[1];
13958
+ const filedInfo = uiSchema.fields[fieldName];
13959
+ if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && ___default.isString(filedInfo.reference_to) ){
13960
+ const rfUiSchema = await getUISchema(filedInfo.reference_to);
13961
+ const rfFieldInfo = rfUiSchema.fields[displayName];
13962
+ fields.push(Object.assign({}, rfFieldInfo,
13963
+ {name: column.field, expand: true, expandInfo: {fieldName, displayName}},
13964
+ {
13965
+ width: column.width,
13966
+ wrap: column.wrap, // wrap = true 是没效果的
13967
+ amis: column.amis
13968
+ }
13969
+ ));
13970
+ }
13971
+ }else {
13972
+ if(uiSchema.fields[column.field]){
13973
+ fields.push(
13974
+ Object.assign({}, uiSchema.fields[column.field], {
13975
+ width: column.width,
13976
+ wrap: column.wrap, // wrap = true 是没效果的
13977
+ amis: column.amis
13978
+ })
13979
+ );
13980
+ }
13981
+ }
13906
13982
  }
13907
- });
13983
+ }
13908
13984
 
13909
13985
  const extraColumns = ctx.extraColumns;
13910
13986
 
@@ -19204,46 +19280,153 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
19204
19280
  * @Author: baozhoutao@steedos.com
19205
19281
  * @Date: 2023-01-14 16:41:24
19206
19282
  * @LastEditors: baozhoutao@steedos.com
19207
- * @LastEditTime: 2023-04-21 11:50:26
19283
+ * @LastEditTime: 2023-07-31 10:22:56
19208
19284
  * @Description:
19209
19285
  */
19210
19286
  var getSelectFlowSchema = function (id, props) {
19211
- var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? 'query' : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? 'input-tree' : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
19212
- console.log("=====onEvent", onEvent);
19213
- return __assign$2({ "type": mode, "id": id, "label": label, "name": name, "options": [], "multiple": multiple, "delimiter": delimiter, "joinValues": joinValues, "extractValue": extractValue, "searchable": searchable, "showOutline": showOutline, "initiallyOpen": initiallyOpen, "unfoldedLevel": unfoldedLevel, "className": className, "required": required, "treeContainerClassName": treeContainerClassName, "heightAuto": true,
19214
- // "menuTpl": {
19215
- // // type: "button",
19216
- // type: "tpl",
19217
- // tpl: "<div class='flex justify-between'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${children != null ? \'hidden\' : \'\'}'><button><i class='fa-regular fa-star'></i></button></span></div>",
19218
- // "onEvent": {
19219
- // "click": {
19220
- // "weight": 0,
19221
- // "actions": [
19222
- // {
19223
- // actionType: 'custom',
19224
- // script: "console.log('====event', event), event.preventDefault(); event.stopPropagation()"
19225
- // },
19226
- // {
19227
- // "args": {
19228
- // "api": {
19229
- // "url": "/aaa",
19230
- // "method": "get",
19231
- // "messages": {
19232
- // }
19233
- // }
19234
- // },
19235
- // "actionType": "download",
19236
- // "stopPropagation": true
19237
- // }
19238
- // ]
19239
- // }
19240
- // }
19241
- // },
19242
- "source": {
19243
- "method": "post",
19244
- "url": "${context.rootUrl}/graphql?keywords=${keywords}",
19245
- "requestAdaptor": "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || '', "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
19246
- "adaptor": "\n payload.data.options?.forEach(function(item,index) {\n if(!item.children || item.children.length == 0){\n payload.data.options.splice(index,1)\n }\n })\n return payload;\n ",
19287
+ var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? "query" : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? "input-tree" : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
19288
+ // console.log(`=====onEvent`, onEvent)
19289
+ return __assign$2({ type: mode, id: id, label: label, name: name, options: [], multiple: multiple, delimiter: delimiter, joinValues: joinValues, extractValue: extractValue, searchable: searchable, showOutline: showOutline, initiallyOpen: initiallyOpen, unfoldedLevel: unfoldedLevel, className: "overflow-y-auto " + className, required: required, treeContainerClassName: treeContainerClassName, heightAuto: true, menuTpl: mode === 'input-tree' ? {
19290
+ type: "tpl",
19291
+ tpl: "<div class='flex'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${value == 'startFlows' ? '' : 'hidden'}'><button class='antd-Button antd-Button--link m-none p-none'>设置</button></span></div>",
19292
+ onEvent: {
19293
+ click: {
19294
+ weight: 0,
19295
+ actions: [
19296
+ {
19297
+ actionType: "dialog",
19298
+ dialog: {
19299
+ type: "dialog",
19300
+ size: "lg",
19301
+ title: {
19302
+ type: "tpl",
19303
+ id: "u:0bce3c33b6e5",
19304
+ tpl: '<p>设置星标流程</p>',
19305
+ },
19306
+ body: [
19307
+ {
19308
+ type: "form",
19309
+ title: "表单",
19310
+ debug: false,
19311
+ body: [
19312
+ {
19313
+ type: "steedos-field",
19314
+ name: "startFlows",
19315
+ field: {
19316
+ name: "startFlows",
19317
+ type: 'lookup',
19318
+ label: "流程名称",
19319
+ required: true,
19320
+ reference_to: 'flows',
19321
+ multiple: true,
19322
+ },
19323
+ // type: "steedos-select-flow",
19324
+ // label: "流程名称",
19325
+ // name: "startFlows",
19326
+ // id: "startFlows",
19327
+ // multiple: true,
19328
+ // mode: "tree-select",
19329
+ // required: true,
19330
+ // options: [],
19331
+ // searchable: true,
19332
+ // amis: {
19333
+ // autoFill: {
19334
+ // users: [],
19335
+ // },
19336
+ // },
19337
+ // onlyLeaf: true
19338
+ }
19339
+ ],
19340
+ id: "u:742f9c0dc8a1",
19341
+ mode: "normal",
19342
+ initApi: {
19343
+ url: "${context.rootUrl}/api/steedos_keyvalues/startFlows",
19344
+ method: "get",
19345
+ dataType: "json",
19346
+ headers: {
19347
+ Authorization: "Bearer ${context.tenantId},${context.authToken}",
19348
+ },
19349
+ },
19350
+ api: {
19351
+ url: "${context.rootUrl}/api/steedos_keyvalues/startFlows",
19352
+ method: "post",
19353
+ dataType: "json",
19354
+ data: {
19355
+ "startFlows": "${startFlows}",
19356
+ },
19357
+ headers: {
19358
+ Authorization: "Bearer ${context.tenantId},${context.authToken}",
19359
+ },
19360
+ messages: {
19361
+ success: "设置成功!",
19362
+ failed: "设置失败",
19363
+ },
19364
+ },
19365
+ onEvent: {
19366
+ submitSucc: {
19367
+ actions: [
19368
+ {
19369
+ componentId: "",
19370
+ args: {},
19371
+ actionType: "closeDialog",
19372
+ },
19373
+ ],
19374
+ }
19375
+ },
19376
+ },
19377
+ ],
19378
+ id: "u:519ca64b1934",
19379
+ actions: [
19380
+ {
19381
+ type: "button",
19382
+ label: "取消",
19383
+ onEvent: {
19384
+ click: {
19385
+ actions: [
19386
+ {
19387
+ componentId: "",
19388
+ args: {},
19389
+ actionType: "closeDialog",
19390
+ },
19391
+ ],
19392
+ },
19393
+ },
19394
+ id: "u:1d0d136fe2f0",
19395
+ },
19396
+ {
19397
+ type: "button",
19398
+ label: "确定",
19399
+ onEvent: {
19400
+ click: {
19401
+ actions: [
19402
+ {
19403
+ args: {},
19404
+ actionType: "validate",
19405
+ componentId: "u:742f9c0dc8a1",
19406
+ },
19407
+ {
19408
+ componentId: "u:742f9c0dc8a1",
19409
+ args: {},
19410
+ actionType: "submit",
19411
+ },
19412
+ ],
19413
+ },
19414
+ },
19415
+ id: "u:f7f767bed23f",
19416
+ level: "primary",
19417
+ },
19418
+ ],
19419
+ },
19420
+ expression: "${event.data.value === 'startFlows' ? true : false}",
19421
+ },
19422
+ ],
19423
+ },
19424
+ },
19425
+ } : '', source: {
19426
+ method: "post",
19427
+ url: "${context.rootUrl}/graphql?keywords=${keywords}",
19428
+ requestAdaptor: "\n const keywords = api.body.keywords || '';\n const appId = '".concat(data.app_id || "", "';\n api.data = {\n query: `\n {\n options: flows__getList(action: \"").concat(action, "\", keywords: \"${keywords}\", appId: \"${appId}\", distributeInstanceId: \"").concat(distributeInstanceId, "\", distributeStepId: \"").concat(distributeStepId, "\"){\n value:_id\n label:name\n children: flows{\n value: _id,\n label: name\n }\n }\n }\n `\n }\n "),
19429
+ adaptor: "\n payload.data.options?.forEach(function(item,index) {\n if(item.value != 'startFlows' && (!item.children || item.children.length == 0)){\n payload.data.options.splice(index,1)\n }\n })\n return payload;\n ",
19247
19430
  "headers": {
19248
19431
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
19249
19432
  }
@@ -19258,45 +19441,45 @@ var getSelectFlowSchema = function (id, props) {
19258
19441
  */
19259
19442
  var AmisSelectFlow = function (props) {
19260
19443
  //mode: "input-tree" | "tree-select"
19261
- var _a = props.mode, mode = _a === void 0 ? 'input-tree' : _a, _b = props.id, id = _b === void 0 ? 'selectFlow' + ___default.random(10000, 99999) : _b;
19444
+ var _a = props.mode, mode = _a === void 0 ? "input-tree" : _a, _b = props.id, id = _b === void 0 ? "selectFlow" + ___default.random(10000, 99999) : _b;
19262
19445
  console.log("AmisSelectFlow props", props);
19263
19446
  var inputId = "".concat(id, "_input");
19264
19447
  var flowSchema = getSelectFlowSchema(inputId, props);
19265
- if (mode === 'tree-select') {
19448
+ if (mode === "tree-select") {
19266
19449
  return flowSchema;
19267
19450
  }
19268
19451
  return {
19269
- "type": "service",
19270
- "id": "selectFlowService",
19271
- "className": "steedos-select-flow-service",
19272
- "body": [
19452
+ type: "service",
19453
+ id: "selectFlowService",
19454
+ className: "steedos-select-flow-service",
19455
+ body: [
19273
19456
  {
19274
- "type": "search-box",
19275
- "className": "!w-full mb-2",
19276
- "name": "keywords",
19277
- "enhance": true,
19278
- "onEvent": {
19279
- "search": {
19280
- "actions": [
19457
+ type: "search-box",
19458
+ className: "!w-full mb-2",
19459
+ name: "keywords",
19460
+ enhance: true,
19461
+ onEvent: {
19462
+ search: {
19463
+ actions: [
19281
19464
  {
19282
- "actionType": "setValue",
19283
- "componentId": "selectFlowService",
19284
- "args": {
19285
- "value": {
19286
- "keywords": "${event.data.keywords}",
19287
- }
19288
- }
19465
+ actionType: "setValue",
19466
+ componentId: "selectFlowService",
19467
+ args: {
19468
+ value: {
19469
+ keywords: "${event.data.keywords}",
19470
+ },
19471
+ },
19289
19472
  },
19290
19473
  {
19291
- "componentId": inputId,
19292
- "actionType": "reload"
19293
- }
19294
- ]
19295
- }
19296
- }
19474
+ componentId: inputId,
19475
+ actionType: "reload",
19476
+ },
19477
+ ],
19478
+ },
19479
+ },
19297
19480
  },
19298
- flowSchema
19299
- ]
19481
+ flowSchema,
19482
+ ],
19300
19483
  };
19301
19484
  };
19302
19485