@steedos-widgets/amis-lib 6.10.11 → 6.10.12
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +87 -49
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +87 -49
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +209 -193
- package/dist/index.umd.js.map +1 -1
- package/dist/types/workflow/approve.d.ts +0 -14
- package/dist/types/workflow/flow.d.ts +0 -14
- package/dist/types/workflow/instance.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -18951,6 +18951,7 @@ const showApproveSignImage = (judge) => {
|
|
|
18951
18951
|
};
|
|
18952
18952
|
|
|
18953
18953
|
const getUserApprove = ({ instance, userId }) => {
|
|
18954
|
+
console.log(`getUserApprove===>`, instance, userId);
|
|
18954
18955
|
const currentTrace = find(instance.traces, (trace) => {
|
|
18955
18956
|
return trace.is_finished != true;
|
|
18956
18957
|
});
|
|
@@ -19590,21 +19591,21 @@ const getApprovalDrawerSchema = async (instance, submitEvents) => {
|
|
|
19590
19591
|
placeholder: i18next$1.t('frontend_workflow_suggestion_placeholder'),//"请填写意见",
|
|
19591
19592
|
requiredOn: "${judge === 'rejected'}",
|
|
19592
19593
|
value: userApprove?.description,
|
|
19593
|
-
"onEvent": {
|
|
19594
|
-
|
|
19595
|
-
|
|
19596
|
-
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
19607
|
-
}
|
|
19594
|
+
// "onEvent": {
|
|
19595
|
+
// "blur": {
|
|
19596
|
+
// "actions": [
|
|
19597
|
+
// {
|
|
19598
|
+
// "componentId": "u:instancePage",
|
|
19599
|
+
// "actionType": "setValue",
|
|
19600
|
+
// "args": {
|
|
19601
|
+
// "value": {
|
|
19602
|
+
// "instance_my_approve_description": "${value}"
|
|
19603
|
+
// }
|
|
19604
|
+
// }
|
|
19605
|
+
// }
|
|
19606
|
+
// ]
|
|
19607
|
+
// }
|
|
19608
|
+
// }
|
|
19608
19609
|
},
|
|
19609
19610
|
await getNextStepInput(instance),
|
|
19610
19611
|
await getNextStepUsersInput(instance),
|
|
@@ -19927,7 +19928,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
19927
19928
|
* @Author: baozhoutao@steedos.com
|
|
19928
19929
|
* @Date: 2022-09-07 16:20:45
|
|
19929
19930
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
19930
|
-
* @LastEditTime: 2025-11-
|
|
19931
|
+
* @LastEditTime: 2025-11-20 20:13:03
|
|
19931
19932
|
* @Description:
|
|
19932
19933
|
*/
|
|
19933
19934
|
|
|
@@ -19950,6 +19951,22 @@ const isOpinionField = (field)=>{
|
|
|
19950
19951
|
return (field_formula?.indexOf("{traces.") > -1 || field_formula?.indexOf("{signature.traces.") > -1 || field_formula?.indexOf("{yijianlan:") > -1 || field_formula?.indexOf("{\"yijianlan\":") > -1 || field_formula?.indexOf("{'yijianlan':") > -1)
|
|
19951
19952
|
};
|
|
19952
19953
|
|
|
19954
|
+
const getArgumentsList = (func)=>{
|
|
19955
|
+
let funcString;
|
|
19956
|
+
if (typeof func === 'function') {
|
|
19957
|
+
funcString = func.toString();
|
|
19958
|
+
} else {
|
|
19959
|
+
funcString = func;
|
|
19960
|
+
}
|
|
19961
|
+
const regExp = /function\s*\w*\(([\s\S]*?)\)/;
|
|
19962
|
+
if (regExp.test(funcString)) {
|
|
19963
|
+
const argList = RegExp.$1.split(',');
|
|
19964
|
+
return argList.map(arg => arg.replace(/\s/g, ''));
|
|
19965
|
+
} else {
|
|
19966
|
+
return [];
|
|
19967
|
+
}
|
|
19968
|
+
};
|
|
19969
|
+
|
|
19953
19970
|
const getFieldEditTpl = async (field, label)=>{
|
|
19954
19971
|
const tpl = {
|
|
19955
19972
|
label: label === true ? field.name : false,
|
|
@@ -20228,6 +20245,8 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
20228
20245
|
tpl.options = getSelectOptions(field);
|
|
20229
20246
|
break;
|
|
20230
20247
|
case "odata":
|
|
20248
|
+
console.log('odata field', field);
|
|
20249
|
+
const argsName = getArgumentsList(field.filters);
|
|
20231
20250
|
var labelField = field.formula.substr(1, field.formula.length - 2);
|
|
20232
20251
|
labelField = labelField.substr(labelField.indexOf(".") + 1);
|
|
20233
20252
|
tpl.type = "select";
|
|
@@ -20240,9 +20259,6 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
20240
20259
|
: `\${context.rootUrl}${field.url}`,
|
|
20241
20260
|
method: "get",
|
|
20242
20261
|
dataType: "json",
|
|
20243
|
-
headers: {
|
|
20244
|
-
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
20245
|
-
},
|
|
20246
20262
|
adaptor:`
|
|
20247
20263
|
payload.data = {
|
|
20248
20264
|
options: _.map(payload.value, (item)=>{
|
|
@@ -20258,8 +20274,30 @@ const getFieldEditTpl = async (field, label)=>{
|
|
|
20258
20274
|
})
|
|
20259
20275
|
}
|
|
20260
20276
|
return payload;
|
|
20277
|
+
`,
|
|
20278
|
+
requestAdaptor: `
|
|
20279
|
+
const field = ${JSON.stringify(field)};
|
|
20280
|
+
if(field.filters){
|
|
20281
|
+
const joinKey = field.url.indexOf('?') > 0 ? '&' : '?';
|
|
20282
|
+
if(field.filters.startsWith('function(') || field.filters.startsWith('function (')){
|
|
20283
|
+
const argsName = ${JSON.stringify(argsName)};
|
|
20284
|
+
const fun = eval('_fun='+field.filters);
|
|
20285
|
+
const funArgs = [];
|
|
20286
|
+
for(const item of argsName){
|
|
20287
|
+
funArgs.push(context[item])
|
|
20288
|
+
}
|
|
20289
|
+
api.url = field.url + joinKey + "$filter=" + fun.apply({}, funArgs)
|
|
20290
|
+
}else{
|
|
20291
|
+
api.url = field.url + joinKey + "$filter=" + field.filters
|
|
20292
|
+
}
|
|
20293
|
+
}
|
|
20294
|
+
api.query = {};
|
|
20295
|
+
console.log('api', api);
|
|
20296
|
+
return api;
|
|
20261
20297
|
`
|
|
20262
20298
|
};
|
|
20299
|
+
// delete tpl.source;
|
|
20300
|
+
console.log('odata tpl', tpl);
|
|
20263
20301
|
break;
|
|
20264
20302
|
case "html":
|
|
20265
20303
|
if (tpl.disabled) {
|
|
@@ -20487,6 +20525,7 @@ const getFormTrs = async (instance) => {
|
|
|
20487
20525
|
const trs = [];
|
|
20488
20526
|
let tdFields = [];
|
|
20489
20527
|
let fields = [];
|
|
20528
|
+
console.log('getFormTrs===>', instance.fields);
|
|
20490
20529
|
each(instance.fields, (field) => {
|
|
20491
20530
|
fields.push(field);
|
|
20492
20531
|
if (field.type === "section" && field.fields) {
|
|
@@ -20533,7 +20572,7 @@ const getFormTableView = async (instance) => {
|
|
|
20533
20572
|
};
|
|
20534
20573
|
|
|
20535
20574
|
const getFormSteps = async (instance) => {
|
|
20536
|
-
const formMode = instance.
|
|
20575
|
+
const formMode = instance.formVersion.mode || "normal";//normal,horizontal,inline
|
|
20537
20576
|
const stepsSchema = [];
|
|
20538
20577
|
let stepFields = [];
|
|
20539
20578
|
let fields = [];
|
|
@@ -20600,7 +20639,7 @@ const getFormSteps = async (instance) => {
|
|
|
20600
20639
|
};
|
|
20601
20640
|
|
|
20602
20641
|
const getFormWizardView = async (instance) => {
|
|
20603
|
-
const wizardMode = instance.
|
|
20642
|
+
const wizardMode = instance.formVersion.wizard_mode || "vertical";//vertical,horizontal
|
|
20604
20643
|
const formSchema = {
|
|
20605
20644
|
type: "wizard",
|
|
20606
20645
|
className: `instance-form-view-wizard ${wizardMode === "horizontal" ? "pt-4" : "pt-1"} mt-3`,
|
|
@@ -20811,7 +20850,7 @@ const getScrollToBottomAutoOpenApproveDrawerScript = () => {
|
|
|
20811
20850
|
};
|
|
20812
20851
|
|
|
20813
20852
|
const getFlowFormSchema = async (instance, box) => {
|
|
20814
|
-
const formStyle = instance.
|
|
20853
|
+
const formStyle = instance.formVersion.style || "table";
|
|
20815
20854
|
let formContentSchema;
|
|
20816
20855
|
if (formStyle === "wizard") {
|
|
20817
20856
|
formContentSchema = await getFormWizardView(instance);
|
|
@@ -20819,7 +20858,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20819
20858
|
else {
|
|
20820
20859
|
formContentSchema = await getFormTableView(instance);
|
|
20821
20860
|
}
|
|
20822
|
-
|
|
20861
|
+
console.log(`formContentSchema`, formContentSchema);
|
|
20823
20862
|
const amisSchemaStr = instance.formVersion?.amis_schema;
|
|
20824
20863
|
|
|
20825
20864
|
let initedEvents = [];
|
|
@@ -20834,7 +20873,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20834
20873
|
}
|
|
20835
20874
|
// if (box == 'inbox' || box == 'draft') {
|
|
20836
20875
|
// TODO: 临时去掉 AutoOpenApproveDrawer 功能因为测试到性能问题
|
|
20837
|
-
if ((box == 'inbox' || box == 'draft') && window.
|
|
20876
|
+
if ((box == 'inbox' || box == 'draft') && window.enableAutoOpenApproveDrawer) {
|
|
20838
20877
|
// 滚动条滚动到底部弹出底部签批drawer窗口
|
|
20839
20878
|
initedEvents.push({
|
|
20840
20879
|
"actionType": "custom",
|
|
@@ -20985,7 +21024,7 @@ const getFlowFormSchema = async (instance, box) => {
|
|
|
20985
21024
|
"args": {
|
|
20986
21025
|
"value": "${event.data.context.approveValues}"
|
|
20987
21026
|
},
|
|
20988
|
-
"expression": "${event.data.context.
|
|
21027
|
+
"expression": "${event.data.context.flowVersion.style === 'wizard'}"// 表单为 wizard 样式时需要初始同步表单数据,否则直接点击暂存按钮会清空数据
|
|
20989
21028
|
},
|
|
20990
21029
|
...initedEvents
|
|
20991
21030
|
]
|
|
@@ -21077,24 +21116,20 @@ const getApproveValues = ({ instance, trace, step, approve, box }) => {
|
|
|
21077
21116
|
return instanceValues;
|
|
21078
21117
|
};
|
|
21079
21118
|
|
|
21080
|
-
const getFlowVersion = (instance) => {
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
}
|
|
21084
|
-
|
|
21085
|
-
|
|
21086
|
-
});
|
|
21087
|
-
}
|
|
21119
|
+
const getFlowVersion = async (instance) => {
|
|
21120
|
+
const result = await fetchAPI$1(`/api/workflow/flow/${instance.flow._id}/version/${instance.flow_version}`, {
|
|
21121
|
+
method: "get"
|
|
21122
|
+
});
|
|
21123
|
+
console.log(`getFlowVersion: `, result);
|
|
21124
|
+
return result;
|
|
21088
21125
|
};
|
|
21089
21126
|
|
|
21090
|
-
const getFormVersion = (instance) => {
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
}
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
});
|
|
21097
|
-
}
|
|
21127
|
+
const getFormVersion = async (instance) => {
|
|
21128
|
+
const result = await fetchAPI$1(`/api/workflow/form/${instance.form._id}/version/${instance.form_version}`, {
|
|
21129
|
+
method: "get"
|
|
21130
|
+
});
|
|
21131
|
+
console.log(`getFormVersion: `, result);
|
|
21132
|
+
return result;
|
|
21098
21133
|
};
|
|
21099
21134
|
|
|
21100
21135
|
const getStep = ({ flowVersion, stepId }) => {
|
|
@@ -21187,17 +21222,13 @@ const getInstanceInfo = async (props) => {
|
|
|
21187
21222
|
name,
|
|
21188
21223
|
style,
|
|
21189
21224
|
mode,
|
|
21190
|
-
wizard_mode
|
|
21191
|
-
current,
|
|
21192
|
-
historys
|
|
21225
|
+
wizard_mode
|
|
21193
21226
|
},
|
|
21194
21227
|
flow_version,
|
|
21195
21228
|
flow:flow__expand{
|
|
21196
21229
|
_id,
|
|
21197
21230
|
name,
|
|
21198
|
-
perms
|
|
21199
|
-
current,
|
|
21200
|
-
historys
|
|
21231
|
+
perms
|
|
21201
21232
|
}
|
|
21202
21233
|
}
|
|
21203
21234
|
}
|
|
@@ -21218,17 +21249,24 @@ const getInstanceInfo = async (props) => {
|
|
|
21218
21249
|
if (!instance) {
|
|
21219
21250
|
return undefined;
|
|
21220
21251
|
}
|
|
21252
|
+
console.log(`box====>`, box);
|
|
21221
21253
|
if (box === "inbox" || box === "draft") {
|
|
21222
21254
|
userApprove = getUserApprove({ instance, userId });
|
|
21223
21255
|
}
|
|
21224
|
-
const flowVersion = getFlowVersion(instance);
|
|
21225
|
-
const formVersion = getFormVersion(instance);
|
|
21256
|
+
const flowVersion = await getFlowVersion(instance);
|
|
21257
|
+
const formVersion = await getFormVersion(instance);
|
|
21258
|
+
|
|
21259
|
+
instance.flowVersion = flowVersion;
|
|
21260
|
+
instance.formVersion = formVersion;
|
|
21226
21261
|
|
|
21227
21262
|
if (userApprove) {
|
|
21228
21263
|
trace = getTrace({ instance, traceId: userApprove.trace });
|
|
21229
21264
|
step = getStep({ flowVersion, stepId: trace.step });
|
|
21230
21265
|
}
|
|
21231
21266
|
|
|
21267
|
+
console.log(`userApprove===>`, userApprove);
|
|
21268
|
+
console.log(`step===>`, step);
|
|
21269
|
+
|
|
21232
21270
|
let currentStep = getStep({ flowVersion, stepId: ___default.last(instance.traces).step });
|
|
21233
21271
|
|
|
21234
21272
|
const lastCCStep = getLastCCStep(instance, userId);
|