@steedos-widgets/amis-lib 3.6.2-beta.9 → 3.6.2
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 +879 -253
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +879 -253
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +209 -124
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/api.d.ts +1 -0
- package/dist/types/lib/converter/amis/fields/editor.d.ts +1 -1
- package/dist/types/lib/converter/amis/fields/file.d.ts +52 -0
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +3 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/columns.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +21 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/filters.d.ts +2 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +20 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/rename.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/share.d.ts +15 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview/sort.d.ts +2 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +130 -0
- package/dist/types/lib/converter/amis/util.d.ts +5 -0
- package/dist/types/lib/input_table.d.ts +24 -15
- package/dist/types/lib/router.d.ts +2 -2
- package/dist/types/schema/standard_import_data.amis.d.ts +7 -0
- package/dist/types/standard/button.d.ts +7 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -335,14 +335,13 @@ const getSteedosAuth = () => {
|
|
|
335
335
|
/*
|
|
336
336
|
* @Author: baozhoutao@steedos.com
|
|
337
337
|
* @Date: 2022-08-16 17:02:08
|
|
338
|
-
* @LastEditors:
|
|
339
|
-
* @LastEditTime:
|
|
338
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
339
|
+
* @LastEditTime: 2024-02-02 10:15:00
|
|
340
340
|
* @Description:
|
|
341
341
|
*/
|
|
342
342
|
|
|
343
343
|
const Router = {
|
|
344
|
-
getTabDisplayAs(tab_id){
|
|
345
|
-
const uiSchema = getUISchemaSync$1(tab_id, false);
|
|
344
|
+
getTabDisplayAs(tab_id, defaultEnableSplit){
|
|
346
345
|
var urlSearch = new URLSearchParams(document.location.search);
|
|
347
346
|
if(urlSearch.has('display')){
|
|
348
347
|
return urlSearch.get('display')
|
|
@@ -351,9 +350,12 @@ const Router = {
|
|
|
351
350
|
// const key = `page_display`;
|
|
352
351
|
const value = sessionStorage.getItem(key);
|
|
353
352
|
let defaultDisplay = "grid";
|
|
354
|
-
if(
|
|
353
|
+
if(defaultEnableSplit === true){
|
|
355
354
|
defaultDisplay = "split";
|
|
356
355
|
}
|
|
356
|
+
if(window.innerWidth <= 768){
|
|
357
|
+
return "grid";
|
|
358
|
+
}
|
|
357
359
|
return value ? value : defaultDisplay;
|
|
358
360
|
},
|
|
359
361
|
|
|
@@ -386,8 +388,8 @@ const Router = {
|
|
|
386
388
|
/*
|
|
387
389
|
* @Author: baozhoutao@steedos.com
|
|
388
390
|
* @Date: 2022-07-20 16:29:22
|
|
389
|
-
* @LastEditors:
|
|
390
|
-
* @LastEditTime:
|
|
391
|
+
* @LastEditors: liaodaxue
|
|
392
|
+
* @LastEditTime: 2024-01-25 14:44:17
|
|
391
393
|
* @Description:
|
|
392
394
|
*/
|
|
393
395
|
|
|
@@ -459,6 +461,25 @@ function getComparableAmisVersion() {
|
|
|
459
461
|
}
|
|
460
462
|
}
|
|
461
463
|
|
|
464
|
+
/**
|
|
465
|
+
* 判断浏览器类型
|
|
466
|
+
* @returns 按需返回浏览器类型;
|
|
467
|
+
*/
|
|
468
|
+
function getBowserType() {
|
|
469
|
+
const userAgent = navigator.userAgent;
|
|
470
|
+
if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
|
|
471
|
+
return "Chrome";
|
|
472
|
+
} else if (userAgent.indexOf("Firefox") !== -1) {
|
|
473
|
+
return "Firefox";
|
|
474
|
+
} else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
|
|
475
|
+
return "Safari";
|
|
476
|
+
} else if (userAgent.indexOf("Edg") !== -1) {
|
|
477
|
+
return "Edge";
|
|
478
|
+
} else {
|
|
479
|
+
return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
462
483
|
/*
|
|
463
484
|
* @Author: baozhoutao@steedos.com
|
|
464
485
|
* @Date: 2022-05-23 09:53:08
|
|
@@ -521,7 +542,7 @@ function getSelectMap(selectOptions){
|
|
|
521
542
|
forEach(selectOptions,(option)=>{
|
|
522
543
|
const optionValue = option.value + '';
|
|
523
544
|
const optionColor = option.color + '';
|
|
524
|
-
if(optionColor){
|
|
545
|
+
if(optionColor && optionColor != "undefined"){
|
|
525
546
|
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
526
547
|
const color = getContrastColor(background);
|
|
527
548
|
const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
|
|
@@ -1137,7 +1158,31 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
1137
1158
|
}
|
|
1138
1159
|
}
|
|
1139
1160
|
if(type === 'file'){
|
|
1140
|
-
return {
|
|
1161
|
+
return window.Meteor?.isCordova ? {
|
|
1162
|
+
"type": "control",
|
|
1163
|
+
"body": {
|
|
1164
|
+
"type": "each",
|
|
1165
|
+
"name": "_display." + steedosField.name,
|
|
1166
|
+
"items": {
|
|
1167
|
+
"type": "tpl",
|
|
1168
|
+
"tpl": "${name}",
|
|
1169
|
+
"className": "antd-Button--link inline-block",
|
|
1170
|
+
"onEvent": {
|
|
1171
|
+
"click": {
|
|
1172
|
+
"actions": [
|
|
1173
|
+
{
|
|
1174
|
+
"script": `
|
|
1175
|
+
Steedos.cordovaDownload(encodeURI(event.data.url), event.data.name);
|
|
1176
|
+
`,
|
|
1177
|
+
"actionType": "custom"
|
|
1178
|
+
}
|
|
1179
|
+
],
|
|
1180
|
+
"weight": 0
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
} : {
|
|
1141
1186
|
type: amisFieldType,
|
|
1142
1187
|
tpl: `
|
|
1143
1188
|
<% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
@@ -1281,6 +1326,7 @@ var frontend_notifications$1 = "Notifications";
|
|
|
1281
1326
|
var frontend_notifications_allread$1 = "Mark all as read";
|
|
1282
1327
|
var frontend_notifications_allread_message$1 = "All marked as read";
|
|
1283
1328
|
var frontend_profile$1 = "Profile";
|
|
1329
|
+
var switch_space$1 = "Switch Space";
|
|
1284
1330
|
var frontend_about$1 = "About";
|
|
1285
1331
|
var frontend_log_out$1 = "Log out";
|
|
1286
1332
|
var frontend_listview_warning_start$1 = "The current ";
|
|
@@ -1368,6 +1414,7 @@ var en_us = {
|
|
|
1368
1414
|
frontend_notifications_allread: frontend_notifications_allread$1,
|
|
1369
1415
|
frontend_notifications_allread_message: frontend_notifications_allread_message$1,
|
|
1370
1416
|
frontend_profile: frontend_profile$1,
|
|
1417
|
+
switch_space: switch_space$1,
|
|
1371
1418
|
frontend_about: frontend_about$1,
|
|
1372
1419
|
frontend_log_out: frontend_log_out$1,
|
|
1373
1420
|
frontend_listview_warning_start: frontend_listview_warning_start$1,
|
|
@@ -1423,7 +1470,7 @@ var frontend_listview_control_delete_label = "删除";
|
|
|
1423
1470
|
var frontend_listview_control_delete_confirm_text = "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?";
|
|
1424
1471
|
var frontend_listview_control_delete_message_success = "删除成功";
|
|
1425
1472
|
var frontend_listview_control_filters = "过滤设置";
|
|
1426
|
-
var frontend_listview_control_filters_fields_extend = "条件组件
|
|
1473
|
+
var frontend_listview_control_filters_fields_extend = "条件组件";
|
|
1427
1474
|
var frontend_listview_control_new_label = "新建";
|
|
1428
1475
|
var frontend_listview_control_new_title = "新建 列表视图";
|
|
1429
1476
|
var frontend_listview_control_new_message_success = "成功";
|
|
@@ -1457,6 +1504,7 @@ var frontend_notifications = "通知";
|
|
|
1457
1504
|
var frontend_notifications_allread = "全部标记为已读";
|
|
1458
1505
|
var frontend_notifications_allread_message = "已全部标记为已读";
|
|
1459
1506
|
var frontend_profile = "个人资料";
|
|
1507
|
+
var switch_space = "切换工作区";
|
|
1460
1508
|
var frontend_about = "关于";
|
|
1461
1509
|
var frontend_log_out = "注销";
|
|
1462
1510
|
var frontend_listview_warning_start = "当前";
|
|
@@ -1545,6 +1593,7 @@ var zh_cn = {
|
|
|
1545
1593
|
frontend_notifications_allread: frontend_notifications_allread,
|
|
1546
1594
|
frontend_notifications_allread_message: frontend_notifications_allread_message,
|
|
1547
1595
|
frontend_profile: frontend_profile,
|
|
1596
|
+
switch_space: switch_space,
|
|
1548
1597
|
frontend_about: frontend_about,
|
|
1549
1598
|
frontend_log_out: frontend_log_out,
|
|
1550
1599
|
frontend_listview_warning_start: frontend_listview_warning_start,
|
|
@@ -1599,7 +1648,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1599
1648
|
isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
|
|
1600
1649
|
}
|
|
1601
1650
|
const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
|
|
1602
|
-
var quickEditSchema = { body: [], id: quickEditId };
|
|
1651
|
+
var quickEditSchema = { body: [], id: quickEditId, className: "steedos-table-quickEdit" };
|
|
1603
1652
|
//select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
|
|
1604
1653
|
if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
|
|
1605
1654
|
const submitEvent = {
|
|
@@ -1858,7 +1907,8 @@ async function getQuickEditSchema(field, options){
|
|
|
1858
1907
|
"failed": "失败了呢。。"
|
|
1859
1908
|
}
|
|
1860
1909
|
}
|
|
1861
|
-
}
|
|
1910
|
+
},
|
|
1911
|
+
"expression": "${!recordPermissions.modifyAllRecords}"
|
|
1862
1912
|
},
|
|
1863
1913
|
{
|
|
1864
1914
|
"actionType": "setValue",
|
|
@@ -1874,7 +1924,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1874
1924
|
"componentId": quickEditId,
|
|
1875
1925
|
"args": {
|
|
1876
1926
|
"value":{
|
|
1877
|
-
"quickedit_record_permissions": "${event.data}"
|
|
1927
|
+
"quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
|
|
1878
1928
|
}
|
|
1879
1929
|
}
|
|
1880
1930
|
}
|
|
@@ -1938,7 +1988,7 @@ async function getQuickEditSchema(field, options){
|
|
|
1938
1988
|
`
|
|
1939
1989
|
}
|
|
1940
1990
|
},
|
|
1941
|
-
"expression":"${event.data.value}"
|
|
1991
|
+
"expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
|
|
1942
1992
|
},
|
|
1943
1993
|
{
|
|
1944
1994
|
"actionType": "setValue",
|
|
@@ -1969,10 +2019,20 @@ async function getQuickEditSchema(field, options){
|
|
|
1969
2019
|
"script": `
|
|
1970
2020
|
const noPermission = event.data.noPermission;
|
|
1971
2021
|
const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
|
|
1972
|
-
|
|
2022
|
+
let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
|
|
1973
2023
|
noPermission.forEach(function (item) {
|
|
1974
2024
|
crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
|
|
2025
|
+
_.remove(selectedItems, (selected) => selected._id === item);
|
|
1975
2026
|
})
|
|
2027
|
+
doAction({
|
|
2028
|
+
"componentId": "${quickEditId}",
|
|
2029
|
+
"actionType": "setValue",
|
|
2030
|
+
"args": {
|
|
2031
|
+
"value": {
|
|
2032
|
+
selectedItems
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
1976
2036
|
`
|
|
1977
2037
|
},
|
|
1978
2038
|
{
|
|
@@ -2033,7 +2093,7 @@ async function getQuickEditSchema(field, options){
|
|
|
2033
2093
|
}
|
|
2034
2094
|
|
|
2035
2095
|
function getFieldWidth(width){
|
|
2036
|
-
const defaultWidth =
|
|
2096
|
+
const defaultWidth = null;
|
|
2037
2097
|
if(typeof width == 'string'){
|
|
2038
2098
|
if(isNaN(width)){
|
|
2039
2099
|
return width || defaultWidth;
|
|
@@ -2063,22 +2123,35 @@ async function getTableColumns(fields, options){
|
|
|
2063
2123
|
//增加quickEdit属性,实现快速编辑
|
|
2064
2124
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2065
2125
|
let className = "";
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2126
|
+
const bowserType = getBowserType();
|
|
2127
|
+
if(bowserType === "Safari"){
|
|
2128
|
+
className += " whitespace-nowrap ";
|
|
2129
|
+
}else {
|
|
2130
|
+
if(field.wrap != true){
|
|
2070
2131
|
className += " whitespace-nowrap ";
|
|
2132
|
+
}else {
|
|
2133
|
+
className += " break-words ";
|
|
2071
2134
|
}
|
|
2072
|
-
}else {
|
|
2073
|
-
className += " break-words ";
|
|
2074
2135
|
}
|
|
2136
|
+
|
|
2137
|
+
if (typeof field.amis?.className == "object") {
|
|
2138
|
+
className = {
|
|
2139
|
+
[className]: "true",
|
|
2140
|
+
...field.amis.className
|
|
2141
|
+
};
|
|
2142
|
+
} else if (typeof field.amis?.className == "string") {
|
|
2143
|
+
className = `${className} ${field.amis.className} `;
|
|
2144
|
+
}
|
|
2145
|
+
let fieldAmis = _$1.clone(field.amis);
|
|
2146
|
+
delete fieldAmis?.className;
|
|
2147
|
+
|
|
2075
2148
|
let columnItem;
|
|
2076
2149
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
2077
2150
|
const previewFileScript = `
|
|
2078
2151
|
var data = event.data;
|
|
2079
2152
|
var file_name = data.versions ? data.name : "${field.label}";
|
|
2080
|
-
var file_id = data._id;
|
|
2081
|
-
|
|
2153
|
+
var file_id = data.versions && data.versions[0] && data.versions[0]._id;
|
|
2154
|
+
window.previewFile && window.previewFile({file_name, file_id});
|
|
2082
2155
|
`;
|
|
2083
2156
|
columnItem = {
|
|
2084
2157
|
"type": "button",
|
|
@@ -2103,11 +2176,11 @@ async function getTableColumns(fields, options){
|
|
|
2103
2176
|
"expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
|
|
2104
2177
|
},
|
|
2105
2178
|
{
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2179
|
+
"args": {},
|
|
2180
|
+
"actionType": "custom",
|
|
2181
|
+
"script": previewFileScript,
|
|
2182
|
+
// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
2183
|
+
"expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
2111
2184
|
}
|
|
2112
2185
|
]
|
|
2113
2186
|
}
|
|
@@ -2122,7 +2195,7 @@ async function getTableColumns(fields, options){
|
|
|
2122
2195
|
toggled: field.toggled,
|
|
2123
2196
|
static: true,
|
|
2124
2197
|
className,
|
|
2125
|
-
},
|
|
2198
|
+
}, fieldAmis, {name: field.name});
|
|
2126
2199
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
2127
2200
|
columnItem = Object.assign({}, {
|
|
2128
2201
|
type: "switch",
|
|
@@ -2133,7 +2206,7 @@ async function getTableColumns(fields, options){
|
|
|
2133
2206
|
static: true,
|
|
2134
2207
|
className,
|
|
2135
2208
|
...getAmisFileReadonlySchema(field)
|
|
2136
|
-
},
|
|
2209
|
+
}, fieldAmis, {name: field.name});
|
|
2137
2210
|
}
|
|
2138
2211
|
else if(field.type === 'select'){
|
|
2139
2212
|
const map = getSelectMap(field.options);
|
|
@@ -2148,7 +2221,7 @@ async function getTableColumns(fields, options){
|
|
|
2148
2221
|
className,
|
|
2149
2222
|
inputClassName: "inline",
|
|
2150
2223
|
static: true,
|
|
2151
|
-
},
|
|
2224
|
+
}, fieldAmis, {name: field.name});
|
|
2152
2225
|
}
|
|
2153
2226
|
else {
|
|
2154
2227
|
const tpl = await getFieldTpl(field, options);
|
|
@@ -2175,15 +2248,6 @@ async function getTableColumns(fields, options){
|
|
|
2175
2248
|
// }
|
|
2176
2249
|
|
|
2177
2250
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
2178
|
-
if (typeof field.amis?.className == "object") {
|
|
2179
|
-
className = {
|
|
2180
|
-
[className]: "true",
|
|
2181
|
-
...field.amis.className
|
|
2182
|
-
};
|
|
2183
|
-
} else if (typeof field.amis?.className == "string") {
|
|
2184
|
-
className = `${className} ${field.amis.className} `;
|
|
2185
|
-
}
|
|
2186
|
-
delete field.amis?.className;
|
|
2187
2251
|
|
|
2188
2252
|
if(!field.hidden && !field.extra){
|
|
2189
2253
|
columnItem = Object.assign({}, {
|
|
@@ -2200,7 +2264,7 @@ async function getTableColumns(fields, options){
|
|
|
2200
2264
|
static: true,
|
|
2201
2265
|
options: field.type === 'html' ? {html: true} : null
|
|
2202
2266
|
// toggled: true
|
|
2203
|
-
},
|
|
2267
|
+
}, fieldAmis, {name: field.name});
|
|
2204
2268
|
|
|
2205
2269
|
if(field.type === 'color'){
|
|
2206
2270
|
columnItem.type = 'color';
|
|
@@ -2396,10 +2460,10 @@ async function getMobileTableColumns(fields, options){
|
|
|
2396
2460
|
if(value.url){
|
|
2397
2461
|
cms_url = value.url;
|
|
2398
2462
|
}else{
|
|
2399
|
-
cms_url = "/api/files/files/"+value+"?download=true"
|
|
2463
|
+
cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
|
|
2400
2464
|
}
|
|
2401
2465
|
}
|
|
2402
|
-
Steedos.cordovaDownload(encodeURI(
|
|
2466
|
+
Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
|
|
2403
2467
|
`,
|
|
2404
2468
|
"actionType": "custom"
|
|
2405
2469
|
}
|
|
@@ -2899,6 +2963,21 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2899
2963
|
return api;
|
|
2900
2964
|
`;
|
|
2901
2965
|
api.adaptor = `
|
|
2966
|
+
let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
|
|
2967
|
+
// 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
|
|
2968
|
+
(payload.data.rows || []).forEach((itemRow) => {
|
|
2969
|
+
(fields || []).forEach((itemField) => {
|
|
2970
|
+
if(itemField && itemField.indexOf(".") > -1){
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
|
|
2974
|
+
// 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
2975
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
2976
|
+
itemRow[itemField] = "";
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
});
|
|
2980
|
+
|
|
2902
2981
|
if(api.body.listName == "recent"){
|
|
2903
2982
|
payload.data.rows = _.sortBy(payload.data.rows, function(item){
|
|
2904
2983
|
return _.indexOf(api.body._ids, item._id)
|
|
@@ -2923,7 +3002,13 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2923
3002
|
value = [value]
|
|
2924
3003
|
};
|
|
2925
3004
|
if(field.type === 'file'){
|
|
2926
|
-
item[key] = value
|
|
3005
|
+
// item[key] = value
|
|
3006
|
+
// PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
|
|
3007
|
+
let itemKeyValue = item[key];
|
|
3008
|
+
item[key] = value.map(function(item, index){
|
|
3009
|
+
item._id = itemKeyValue[index];
|
|
3010
|
+
return item;
|
|
3011
|
+
});
|
|
2927
3012
|
}else{
|
|
2928
3013
|
item[key] = _.map(value, (item)=>{
|
|
2929
3014
|
if(field.type === 'image'){
|
|
@@ -2965,15 +3050,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2965
3050
|
}
|
|
2966
3051
|
});
|
|
2967
3052
|
};
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
isTreeOptionsComputed = true;
|
|
2971
|
-
}
|
|
2972
|
-
if(!isTreeOptionsComputed){
|
|
2973
|
-
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
2974
|
-
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
2975
|
-
assignIndexToTreeRecords(payload.data.rows, '');
|
|
2976
|
-
}
|
|
3053
|
+
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
3054
|
+
assignIndexToTreeRecords(payload.data.rows, '');
|
|
2977
3055
|
}
|
|
2978
3056
|
|
|
2979
3057
|
|
|
@@ -3032,11 +3110,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
3032
3110
|
};
|
|
3033
3111
|
let formFactor = "${options.formFactor}";
|
|
3034
3112
|
if(formFactor !== "SMALL"){
|
|
3035
|
-
const
|
|
3036
|
-
|
|
3037
|
-
if(firstListviewComponent){
|
|
3113
|
+
const lisviewDom = document.querySelector(".steedos-object-listview .antd-Table-table");
|
|
3114
|
+
if(lisviewDom){
|
|
3038
3115
|
setTimeout(()=>{
|
|
3039
|
-
|
|
3116
|
+
lisviewDom.scrollIntoView();
|
|
3040
3117
|
}, 600);
|
|
3041
3118
|
}
|
|
3042
3119
|
}
|
|
@@ -4869,9 +4946,16 @@ const getSchema$2 = (uiSchema) => {
|
|
|
4869
4946
|
"form": {
|
|
4870
4947
|
debug: false,
|
|
4871
4948
|
resetAfterSubmit: false,
|
|
4949
|
+
data: {
|
|
4950
|
+
editFormInited: true,
|
|
4951
|
+
},
|
|
4872
4952
|
initApi: {
|
|
4953
|
+
method: 'GET',
|
|
4873
4954
|
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
4874
4955
|
sendOn: 'this.recordId',
|
|
4956
|
+
data: null,
|
|
4957
|
+
requestAdaptor: "return api;",
|
|
4958
|
+
adaptor: "return payload;",
|
|
4875
4959
|
responseData: {
|
|
4876
4960
|
importState: "${state}"
|
|
4877
4961
|
}
|
|
@@ -5743,7 +5827,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
5743
5827
|
const formSchema = {
|
|
5744
5828
|
"type": "service",
|
|
5745
5829
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
5746
|
-
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-
|
|
5830
|
+
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
|
|
5747
5831
|
"style":{
|
|
5748
5832
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
5749
5833
|
},
|
|
@@ -6330,7 +6414,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6330
6414
|
"className": "slds-filters"
|
|
6331
6415
|
},
|
|
6332
6416
|
"size": "xs",
|
|
6333
|
-
"className": `border-
|
|
6417
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
6334
6418
|
"visibleOn": "this.showFieldsFilter",
|
|
6335
6419
|
},
|
|
6336
6420
|
"className": "bg-white"
|
|
@@ -6518,7 +6602,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6518
6602
|
"icon": "fa fa-refresh",
|
|
6519
6603
|
"actionType": "reload",
|
|
6520
6604
|
"target": amisListViewId,
|
|
6521
|
-
"className": "bg-white p-2 rounded
|
|
6605
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
6522
6606
|
},
|
|
6523
6607
|
fieldsFilterButtonSchema,
|
|
6524
6608
|
// {
|
|
@@ -6526,7 +6610,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6526
6610
|
// "label": "",
|
|
6527
6611
|
// "icon": "fa fa-filter",
|
|
6528
6612
|
// "actionType": "custom",
|
|
6529
|
-
// "className": "bg-transparent p-2 rounded
|
|
6613
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
6530
6614
|
// "id": "u:c20cb87d96c9",
|
|
6531
6615
|
// "onEvent": {
|
|
6532
6616
|
// "click": {
|
|
@@ -6574,7 +6658,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6574
6658
|
let headerSchema = [{
|
|
6575
6659
|
"type": "wrapper",
|
|
6576
6660
|
"body": body,
|
|
6577
|
-
"className": `
|
|
6661
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
6578
6662
|
}];
|
|
6579
6663
|
return headerSchema;
|
|
6580
6664
|
}
|
|
@@ -6709,7 +6793,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6709
6793
|
let body = [
|
|
6710
6794
|
{
|
|
6711
6795
|
"type": "wrapper",
|
|
6712
|
-
"className": "p-4
|
|
6796
|
+
"className": "p-4 border-b",
|
|
6713
6797
|
"body": [
|
|
6714
6798
|
{
|
|
6715
6799
|
"type": "grid",
|
|
@@ -6774,25 +6858,25 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6774
6858
|
});
|
|
6775
6859
|
|
|
6776
6860
|
// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
6777
|
-
//
|
|
6778
|
-
//
|
|
6779
|
-
//
|
|
6780
|
-
//
|
|
6781
|
-
//
|
|
6782
|
-
//
|
|
6783
|
-
//
|
|
6784
|
-
//
|
|
6785
|
-
//
|
|
6786
|
-
//
|
|
6787
|
-
//
|
|
6788
|
-
//
|
|
6861
|
+
// lg:grid-cols-1
|
|
6862
|
+
// lg:grid-cols-2
|
|
6863
|
+
// lg:grid-cols-3
|
|
6864
|
+
// lg:grid-cols-4
|
|
6865
|
+
// lg:grid-cols-5
|
|
6866
|
+
// lg:grid-cols-6
|
|
6867
|
+
// lg:grid-cols-7
|
|
6868
|
+
// lg:grid-cols-8
|
|
6869
|
+
// lg:grid-cols-9
|
|
6870
|
+
// lg:grid-cols-10
|
|
6871
|
+
// lg:grid-cols-11
|
|
6872
|
+
// lg:grid-cols-12
|
|
6789
6873
|
|
|
6790
6874
|
body.push({
|
|
6791
6875
|
"type": "wrapper",
|
|
6792
6876
|
"body": {
|
|
6793
6877
|
"type": "form",
|
|
6794
6878
|
// "className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
|
|
6795
|
-
"className": `gap-2 grid grid-cols-1
|
|
6879
|
+
"className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
|
|
6796
6880
|
"wrapWithPanel": false,
|
|
6797
6881
|
"actions": [],
|
|
6798
6882
|
"body": details,
|
|
@@ -6877,7 +6961,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6877
6961
|
"className": "flex justify-between"
|
|
6878
6962
|
}
|
|
6879
6963
|
],
|
|
6880
|
-
"className": "steedos-record-related-header py-2 px-
|
|
6964
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
|
|
6881
6965
|
};
|
|
6882
6966
|
return recordRelatedListHeader;
|
|
6883
6967
|
}
|
|
@@ -6920,6 +7004,7 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
6920
7004
|
"objectApiName": "object_listviews",
|
|
6921
7005
|
"recordId": "",
|
|
6922
7006
|
"mode": "edit",
|
|
7007
|
+
"layout": "normal",
|
|
6923
7008
|
"defaultData": {
|
|
6924
7009
|
"&": "${list_view}",
|
|
6925
7010
|
"name":"",
|
|
@@ -6927,8 +7012,16 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
6927
7012
|
"filters":"",
|
|
6928
7013
|
"shared":false,
|
|
6929
7014
|
"object_name": "${targetObjectName}",
|
|
7015
|
+
"_id":"",
|
|
7016
|
+
"shared_to": null,
|
|
7017
|
+
"shared_to_organizations": null,
|
|
7018
|
+
"locked": false,
|
|
7019
|
+
"owner": null,
|
|
7020
|
+
"company_id": null,
|
|
7021
|
+
"company_ids": null,
|
|
7022
|
+
"is_system": false
|
|
6930
7023
|
},
|
|
6931
|
-
"fieldsExtend": fieldsExtend$
|
|
7024
|
+
"fieldsExtend": fieldsExtend$5(),
|
|
6932
7025
|
"fields": fields$1(),
|
|
6933
7026
|
"onEvent": {
|
|
6934
7027
|
"submitSucc": {
|
|
@@ -6979,14 +7072,17 @@ function fields$1(){
|
|
|
6979
7072
|
"mobile_columns",
|
|
6980
7073
|
"searchable_fields",
|
|
6981
7074
|
"is_system",
|
|
6982
|
-
"shared"
|
|
7075
|
+
"shared",
|
|
7076
|
+
"shared_to",
|
|
7077
|
+
"shared_to_organizations"
|
|
6983
7078
|
]
|
|
6984
7079
|
}
|
|
6985
7080
|
|
|
6986
|
-
function fieldsExtend$
|
|
7081
|
+
function fieldsExtend$5(){
|
|
6987
7082
|
return {
|
|
6988
7083
|
"group": "",
|
|
6989
7084
|
"label": {
|
|
7085
|
+
"group": "",
|
|
6990
7086
|
"is_wide": true
|
|
6991
7087
|
},
|
|
6992
7088
|
"name": {
|
|
@@ -7068,9 +7164,19 @@ function fieldsExtend$4(){
|
|
|
7068
7164
|
"shared": {
|
|
7069
7165
|
"group": "",
|
|
7070
7166
|
"amis": {
|
|
7071
|
-
"visibleOn": "${
|
|
7167
|
+
"visibleOn": "${false}"
|
|
7072
7168
|
}
|
|
7073
7169
|
},
|
|
7170
|
+
"shared_to": {
|
|
7171
|
+
"group": "",
|
|
7172
|
+
"amis":{
|
|
7173
|
+
"type": "radios",
|
|
7174
|
+
"inline": false
|
|
7175
|
+
}
|
|
7176
|
+
},
|
|
7177
|
+
"shared_to_organizations": {
|
|
7178
|
+
"group": ""
|
|
7179
|
+
},
|
|
7074
7180
|
"filters": {
|
|
7075
7181
|
"group": "",
|
|
7076
7182
|
"amis": {
|
|
@@ -7108,14 +7214,23 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
7108
7214
|
"objectApiName": "object_listviews",
|
|
7109
7215
|
"recordId": "",
|
|
7110
7216
|
"mode": "edit",
|
|
7217
|
+
"layout": "normal",
|
|
7111
7218
|
"defaultData": {
|
|
7112
7219
|
"&": "${list_view}",
|
|
7113
7220
|
"name":"",
|
|
7114
7221
|
"label": i18next.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + i18next.t('frontend_listview_control_clone_defaultData_label_end'),
|
|
7115
7222
|
"shared":false,
|
|
7116
7223
|
"object_name": "${targetObjectName}",
|
|
7224
|
+
"_id":"",
|
|
7225
|
+
"shared_to": null,
|
|
7226
|
+
"shared_to_organizations": null,
|
|
7227
|
+
"locked": false,
|
|
7228
|
+
"owner": null,
|
|
7229
|
+
"company_id": null,
|
|
7230
|
+
"company_ids": null,
|
|
7231
|
+
"is_system": false
|
|
7117
7232
|
},
|
|
7118
|
-
"fieldsExtend": fieldsExtend$
|
|
7233
|
+
"fieldsExtend": fieldsExtend$4(),
|
|
7119
7234
|
"fields": fields(),
|
|
7120
7235
|
"onEvent": {
|
|
7121
7236
|
"submitSucc": {
|
|
@@ -7163,13 +7278,16 @@ function fields(){
|
|
|
7163
7278
|
"mobile_columns.$.field",
|
|
7164
7279
|
"searchable_fields.$.field",
|
|
7165
7280
|
"is_system",
|
|
7166
|
-
"shared"
|
|
7281
|
+
"shared",
|
|
7282
|
+
"shared_to",
|
|
7283
|
+
"shared_to_organizations"
|
|
7167
7284
|
]
|
|
7168
7285
|
}
|
|
7169
7286
|
|
|
7170
|
-
function fieldsExtend$
|
|
7287
|
+
function fieldsExtend$4(){
|
|
7171
7288
|
return {
|
|
7172
7289
|
"label": {
|
|
7290
|
+
"group": "",
|
|
7173
7291
|
"is_wide": true
|
|
7174
7292
|
},
|
|
7175
7293
|
"name": {
|
|
@@ -7219,10 +7337,21 @@ function fieldsExtend$3(){
|
|
|
7219
7337
|
}
|
|
7220
7338
|
},
|
|
7221
7339
|
"shared": {
|
|
7340
|
+
"group": "",
|
|
7222
7341
|
"amis": {
|
|
7223
|
-
"visibleOn": "${
|
|
7342
|
+
"visibleOn": "${false}"
|
|
7224
7343
|
}
|
|
7225
7344
|
},
|
|
7345
|
+
"shared_to": {
|
|
7346
|
+
"group": "",
|
|
7347
|
+
"amis":{
|
|
7348
|
+
"type": "radios",
|
|
7349
|
+
"inline": false
|
|
7350
|
+
}
|
|
7351
|
+
},
|
|
7352
|
+
"shared_to_organizations": {
|
|
7353
|
+
"group": ""
|
|
7354
|
+
},
|
|
7226
7355
|
"filters": {
|
|
7227
7356
|
"group": "",
|
|
7228
7357
|
"amis": {
|
|
@@ -7232,6 +7361,12 @@ function fieldsExtend$3(){
|
|
|
7232
7361
|
}
|
|
7233
7362
|
}
|
|
7234
7363
|
|
|
7364
|
+
/*
|
|
7365
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
7366
|
+
* @Date: 2023-06-13 13:51:19
|
|
7367
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7368
|
+
* @LastEditTime: 2024-02-05 11:25:09
|
|
7369
|
+
*/
|
|
7235
7370
|
const getRenameListviewButtonSchema = ()=>{
|
|
7236
7371
|
return {
|
|
7237
7372
|
"type": "button",
|
|
@@ -7257,6 +7392,7 @@ const getRenameListviewButtonSchema = ()=>{
|
|
|
7257
7392
|
"label": "对象表单",
|
|
7258
7393
|
"objectApiName": "object_listviews",
|
|
7259
7394
|
"recordId": "${recordId}",
|
|
7395
|
+
"layout": "normal",
|
|
7260
7396
|
"mode": "edit",
|
|
7261
7397
|
"fields": [
|
|
7262
7398
|
"label"
|
|
@@ -7291,6 +7427,12 @@ const getRenameListviewButtonSchema = ()=>{
|
|
|
7291
7427
|
}
|
|
7292
7428
|
};
|
|
7293
7429
|
|
|
7430
|
+
/*
|
|
7431
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
7432
|
+
* @Date: 2023-06-13 13:51:19
|
|
7433
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
7434
|
+
* @LastEditTime: 2024-02-06 15:38:49
|
|
7435
|
+
*/
|
|
7294
7436
|
const getSetListviewShareButtonSchema = ()=>{
|
|
7295
7437
|
return {
|
|
7296
7438
|
"type": "button",
|
|
@@ -7306,6 +7448,8 @@ const getSetListviewShareButtonSchema = ()=>{
|
|
|
7306
7448
|
"title": i18next.t('frontend_listview_control_share'),
|
|
7307
7449
|
"data": {
|
|
7308
7450
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
7451
|
+
"appId": "${appId}",
|
|
7452
|
+
"global": "${global}",
|
|
7309
7453
|
"context": "${context}"
|
|
7310
7454
|
},
|
|
7311
7455
|
"body": [
|
|
@@ -7315,9 +7459,12 @@ const getSetListviewShareButtonSchema = ()=>{
|
|
|
7315
7459
|
"objectApiName": "object_listviews",
|
|
7316
7460
|
"recordId": "${recordId}",
|
|
7317
7461
|
"mode": "edit",
|
|
7462
|
+
"layout": "normal",
|
|
7318
7463
|
"fields": [
|
|
7319
|
-
"
|
|
7320
|
-
|
|
7464
|
+
"shared_to",
|
|
7465
|
+
"shared_to_organizations"
|
|
7466
|
+
],
|
|
7467
|
+
"fieldsExtend": fieldsExtend$3(),
|
|
7321
7468
|
}
|
|
7322
7469
|
],
|
|
7323
7470
|
"showCloseButton": true,
|
|
@@ -7335,6 +7482,21 @@ const getSetListviewShareButtonSchema = ()=>{
|
|
|
7335
7482
|
}
|
|
7336
7483
|
};
|
|
7337
7484
|
|
|
7485
|
+
function fieldsExtend$3(){
|
|
7486
|
+
return {
|
|
7487
|
+
"shared_to": {
|
|
7488
|
+
"group": "",
|
|
7489
|
+
"amis":{
|
|
7490
|
+
"type": "radios",
|
|
7491
|
+
"inline": false
|
|
7492
|
+
}
|
|
7493
|
+
},
|
|
7494
|
+
"shared_to_organizations": {
|
|
7495
|
+
"group": ""
|
|
7496
|
+
}
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7499
|
+
|
|
7338
7500
|
const getSetListviewFiltersButtonSchema = ()=>{
|
|
7339
7501
|
return {
|
|
7340
7502
|
"type": "button",
|
|
@@ -7466,10 +7628,12 @@ function apiRequestAdaptor$2(){
|
|
|
7466
7628
|
function fieldsExtend$2(){
|
|
7467
7629
|
return {
|
|
7468
7630
|
"filters": {
|
|
7631
|
+
"label": "",
|
|
7632
|
+
"group": "",
|
|
7469
7633
|
"visible_on": "true",
|
|
7470
7634
|
"amis": {
|
|
7471
7635
|
"type": "condition-builder",
|
|
7472
|
-
"label": i18next.t('frontend_listview_control_filters_fields_extend'),
|
|
7636
|
+
// "label": i18next.t('frontend_listview_control_filters_fields_extend'),
|
|
7473
7637
|
"source": {
|
|
7474
7638
|
"method": "get",
|
|
7475
7639
|
"url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
|
|
@@ -7512,6 +7676,7 @@ const getSetListviewColumnsButtonSchema = ()=>{
|
|
|
7512
7676
|
"objectApiName": "object_listviews",
|
|
7513
7677
|
"recordId": "${recordId}",
|
|
7514
7678
|
"mode": "edit",
|
|
7679
|
+
"layout": "normal",
|
|
7515
7680
|
"fieldsExtend": fieldsExtend$1(),
|
|
7516
7681
|
"initApiAdaptor": initApiAdaptor$1(),
|
|
7517
7682
|
"apiRequestAdaptor": apiRequestAdaptor$1(),
|
|
@@ -7708,6 +7873,8 @@ const getSetListviewSortButtonSchema = ()=>{
|
|
|
7708
7873
|
function fieldsExtend(){
|
|
7709
7874
|
return {
|
|
7710
7875
|
"sort": {
|
|
7876
|
+
"label": "",
|
|
7877
|
+
"group": "",
|
|
7711
7878
|
"amis": {
|
|
7712
7879
|
"type": "tabs-transfer",
|
|
7713
7880
|
"sortable": true,
|
|
@@ -7835,7 +8002,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7835
8002
|
"icon": "fa fa-cog",
|
|
7836
8003
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7837
8004
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
7838
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
8005
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7839
8006
|
"align": "right",
|
|
7840
8007
|
"visibleOn": "${!isLookup}",
|
|
7841
8008
|
"buttons": [
|
|
@@ -7856,8 +8023,8 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7856
8023
|
}
|
|
7857
8024
|
};
|
|
7858
8025
|
|
|
7859
|
-
const getDisplayAsButton = function(objectName,
|
|
7860
|
-
let displayAs = Router$1.getTabDisplayAs(objectName);
|
|
8026
|
+
const getDisplayAsButton = function(objectName, defaultEnableSplit){
|
|
8027
|
+
let displayAs = Router$1.getTabDisplayAs(objectName, defaultEnableSplit);
|
|
7861
8028
|
let buttons = [
|
|
7862
8029
|
{
|
|
7863
8030
|
"type": "button",
|
|
@@ -7880,7 +8047,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7880
8047
|
"icon": "fa fa-table-columns",
|
|
7881
8048
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7882
8049
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
7883
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
8050
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7884
8051
|
"align": "right",
|
|
7885
8052
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
7886
8053
|
"buttons": [
|
|
@@ -8073,7 +8240,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8073
8240
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8074
8241
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8075
8242
|
// "tooltipPlacement": "top",
|
|
8076
|
-
// "className": "bg-white p-2 rounded
|
|
8243
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
8077
8244
|
// "label": "",
|
|
8078
8245
|
// "icon": "fa fa-sync",
|
|
8079
8246
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -8097,7 +8264,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8097
8264
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8098
8265
|
"tooltip":"",
|
|
8099
8266
|
"tooltipPlacement": "top",
|
|
8100
|
-
"className": "bg-white p-2 rounded
|
|
8267
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8101
8268
|
};
|
|
8102
8269
|
}
|
|
8103
8270
|
else {
|
|
@@ -8108,7 +8275,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8108
8275
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8109
8276
|
"tooltip":"",
|
|
8110
8277
|
"tooltipPlacement": "top",
|
|
8111
|
-
"className": "bg-white p-2 rounded
|
|
8278
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8112
8279
|
};
|
|
8113
8280
|
}
|
|
8114
8281
|
let toolbarFilter;
|
|
@@ -8130,7 +8297,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8130
8297
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8131
8298
|
},
|
|
8132
8299
|
"align": "right",
|
|
8133
|
-
"className": "bg-white p-2 rounded
|
|
8300
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
8134
8301
|
"onEvent": {
|
|
8135
8302
|
"click": {
|
|
8136
8303
|
"actions": [
|
|
@@ -8144,7 +8311,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8144
8311
|
"id": "steedos_crud_toolbar_filter"
|
|
8145
8312
|
};
|
|
8146
8313
|
}
|
|
8147
|
-
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
|
|
8314
|
+
let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name, mainObject?.enable_split);
|
|
8148
8315
|
let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
|
|
8149
8316
|
|
|
8150
8317
|
// toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
|
|
@@ -8290,7 +8457,6 @@ async function getObjectFilter(objectSchema, fields, options) {
|
|
|
8290
8457
|
"timeOut": 1000
|
|
8291
8458
|
}
|
|
8292
8459
|
});
|
|
8293
|
-
resizeWindow();
|
|
8294
8460
|
const scope = event.context.scoped;
|
|
8295
8461
|
// let filterFormValues = event.data;
|
|
8296
8462
|
let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
|
|
@@ -8457,7 +8623,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8457
8623
|
const bodyProps = {
|
|
8458
8624
|
// toolbar: getToolbar(),
|
|
8459
8625
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
8460
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
8626
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
8461
8627
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
8462
8628
|
...options,
|
|
8463
8629
|
disableStatistics: options.queryCount === false
|
|
@@ -8604,14 +8770,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8604
8770
|
headers: {
|
|
8605
8771
|
Authorization: "Bearer ${context.tenantId},${context.authToken}",
|
|
8606
8772
|
},
|
|
8607
|
-
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8608
|
-
adaptor: `
|
|
8609
|
-
if(payload.errors){
|
|
8610
|
-
payload.status = 2;
|
|
8611
|
-
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8612
|
-
}
|
|
8613
|
-
return payload;
|
|
8614
|
-
`
|
|
8773
|
+
requestAdaptor: quickSaveApiRequestAdaptor
|
|
8615
8774
|
},
|
|
8616
8775
|
// 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
|
|
8617
8776
|
// 使用表达式给tr添加初始选中状态
|
|
@@ -8628,6 +8787,20 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8628
8787
|
crudModeClassName = `steedos-crud-mode-${body.mode}`;
|
|
8629
8788
|
}
|
|
8630
8789
|
|
|
8790
|
+
body.quickSaveApi.adaptor = `
|
|
8791
|
+
if(payload.errors){
|
|
8792
|
+
payload.status = 2;
|
|
8793
|
+
payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
|
|
8794
|
+
}
|
|
8795
|
+
var scope = SteedosUI.getRef(context.scopeId);
|
|
8796
|
+
var scopeParent = scope && scope.parent;
|
|
8797
|
+
var crudScoped = scopeParent.getComponentById('${body.id}');
|
|
8798
|
+
setTimeout(()=>{
|
|
8799
|
+
crudScoped && crudScoped.control.updateAutoFillHeight();
|
|
8800
|
+
}, 500);
|
|
8801
|
+
return payload;
|
|
8802
|
+
`;
|
|
8803
|
+
|
|
8631
8804
|
if(body.columns && options.formFactor != 'SMALL'){
|
|
8632
8805
|
//将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
|
|
8633
8806
|
body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
|
|
@@ -8993,7 +9166,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
8993
9166
|
* @Author: baozhoutao@steedos.com
|
|
8994
9167
|
* @Date: 2022-07-05 15:55:39
|
|
8995
9168
|
* @LastEditors: baozhoutao@steedos.com
|
|
8996
|
-
* @LastEditTime: 2024-01-
|
|
9169
|
+
* @LastEditTime: 2024-01-24 10:18:17
|
|
8997
9170
|
* @Description:
|
|
8998
9171
|
*/
|
|
8999
9172
|
|
|
@@ -9092,7 +9265,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9092
9265
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9093
9266
|
mainRelated[arr[0]] = foreign_key_value;
|
|
9094
9267
|
}
|
|
9095
|
-
}
|
|
9268
|
+
}
|
|
9269
|
+
// 防止related_lists中没有相关子表,但是details中有相关子表的情况
|
|
9270
|
+
if(!mainRelated[relatedObjectName]){
|
|
9096
9271
|
const details = union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
9097
9272
|
for (const detail of details) {
|
|
9098
9273
|
const arr = detail.split(".");
|
|
@@ -9181,7 +9356,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9181
9356
|
amisSchema: {
|
|
9182
9357
|
type: "service",
|
|
9183
9358
|
id: componentId,
|
|
9184
|
-
className: `steedos-record-related-list
|
|
9359
|
+
className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className}`,
|
|
9185
9360
|
data: {
|
|
9186
9361
|
relatedKey: relatedKey,
|
|
9187
9362
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9409,8 +9584,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9409
9584
|
/*
|
|
9410
9585
|
* @Author: baozhoutao@steedos.com
|
|
9411
9586
|
* @Date: 2022-07-05 15:55:39
|
|
9412
|
-
* @LastEditors:
|
|
9413
|
-
* @LastEditTime: 2024-
|
|
9587
|
+
* @LastEditors: liaodaxue
|
|
9588
|
+
* @LastEditTime: 2024-02-05 17:56:27
|
|
9414
9589
|
* @Description:
|
|
9415
9590
|
*/
|
|
9416
9591
|
|
|
@@ -9766,6 +9941,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
9766
9941
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
9767
9942
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
9768
9943
|
fields.push(Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx));
|
|
9944
|
+
}else if(filedInfo && filedInfo.type === 'object'){
|
|
9945
|
+
fields.push(uiSchema.fields[column]);
|
|
9769
9946
|
}
|
|
9770
9947
|
} else {
|
|
9771
9948
|
if (uiSchema.fields[column]) {
|
|
@@ -9927,7 +10104,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9927
10104
|
};
|
|
9928
10105
|
const content = {
|
|
9929
10106
|
"type": "tabs",
|
|
9930
|
-
"className": "steedos-record-tabs bg-white p-4
|
|
10107
|
+
"className": "steedos-record-tabs bg-white p-4 mt-3 border-y",
|
|
9931
10108
|
"contentClassName": "bg-none",
|
|
9932
10109
|
"tabs": [
|
|
9933
10110
|
detailed
|
|
@@ -10628,17 +10805,13 @@ function getReferenceToSync(field) {
|
|
|
10628
10805
|
|
|
10629
10806
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
10630
10807
|
let apiAdaptor = `
|
|
10631
|
-
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
10632
10808
|
const records = payload.data.options;
|
|
10633
|
-
let isTreeOptionsComputed = false;
|
|
10634
|
-
if(records.length === 1 && records[0].children){
|
|
10635
|
-
isTreeOptionsComputed = true;
|
|
10636
|
-
}
|
|
10637
|
-
if(isTreeOptionsComputed){
|
|
10638
|
-
return payload;
|
|
10639
|
-
}
|
|
10640
10809
|
const treeRecords = [];
|
|
10641
|
-
const getChildren = (records, childrenIds) => {
|
|
10810
|
+
const getChildren = (currentRecord, records, childrenIds) => {
|
|
10811
|
+
if (currentRecord.children && typeof currentRecord.children[0] === "object") {
|
|
10812
|
+
// 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
|
|
10813
|
+
return currentRecord.children;
|
|
10814
|
+
}
|
|
10642
10815
|
if (!childrenIds) {
|
|
10643
10816
|
return;
|
|
10644
10817
|
}
|
|
@@ -10647,7 +10820,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10647
10820
|
});
|
|
10648
10821
|
_.each(children, (item) => {
|
|
10649
10822
|
if (item.children) {
|
|
10650
|
-
item.children = getChildren(records, item.children)
|
|
10823
|
+
item.children = getChildren(item, records, item.children)
|
|
10651
10824
|
}else{
|
|
10652
10825
|
item.children = [];
|
|
10653
10826
|
}
|
|
@@ -10673,7 +10846,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10673
10846
|
|
|
10674
10847
|
_.each(records, (record) => {
|
|
10675
10848
|
if (record.noParent == 1) {
|
|
10676
|
-
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
10849
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
|
|
10677
10850
|
}
|
|
10678
10851
|
});
|
|
10679
10852
|
console.log(treeRecords)
|
|
@@ -10723,6 +10896,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10723
10896
|
}
|
|
10724
10897
|
},
|
|
10725
10898
|
"label": "",
|
|
10899
|
+
"mode": "normal",
|
|
10726
10900
|
"name": "organizations",
|
|
10727
10901
|
"multiple": false,
|
|
10728
10902
|
"joinValues": false,
|
|
@@ -10865,6 +11039,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10865
11039
|
}
|
|
10866
11040
|
});
|
|
10867
11041
|
|
|
11042
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11043
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11044
|
+
|
|
10868
11045
|
let sort = "";
|
|
10869
11046
|
if(listView){
|
|
10870
11047
|
sort = getListViewSort(listView);
|
|
@@ -10911,7 +11088,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10911
11088
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10912
11089
|
}
|
|
10913
11090
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10914
|
-
var filters = [];
|
|
11091
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
10915
11092
|
var pageSize = api.data.pageSize || 10;
|
|
10916
11093
|
var pageNo = api.data.pageNo || 1;
|
|
10917
11094
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -10973,6 +11150,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10973
11150
|
}
|
|
10974
11151
|
|
|
10975
11152
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11153
|
+
|
|
11154
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11155
|
+
|
|
11156
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11157
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
11158
|
+
if(_filters0 && _filters0.length){
|
|
11159
|
+
filters.push(_filters0);
|
|
11160
|
+
}
|
|
11161
|
+
}
|
|
11162
|
+
|
|
10976
11163
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
10977
11164
|
|
|
10978
11165
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11060,6 +11247,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11060
11247
|
});
|
|
11061
11248
|
payload.data.rows = treeRecords;
|
|
11062
11249
|
}
|
|
11250
|
+
const result = payload.data.rows;
|
|
11251
|
+
if(result && result.length){
|
|
11252
|
+
const updatedResult = _.map(result, (element) => {
|
|
11253
|
+
const data = { ...element };
|
|
11254
|
+
// image字段值添加URL前缀
|
|
11255
|
+
${getScriptForAddUrlPrefixForImgFields(_$1.values(refObjectConfig.fields))}
|
|
11256
|
+
return data;
|
|
11257
|
+
});
|
|
11258
|
+
payload.data.rows = updatedResult;
|
|
11259
|
+
}
|
|
11063
11260
|
return payload;
|
|
11064
11261
|
`;
|
|
11065
11262
|
if(field.optionsFunction || field._optionsFunction){
|
|
@@ -11091,13 +11288,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11091
11288
|
|
|
11092
11289
|
pickerSchema.affixHeader = false;
|
|
11093
11290
|
|
|
11094
|
-
|
|
11291
|
+
|
|
11292
|
+
|
|
11293
|
+
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
|
|
11294
|
+
|
|
11095
11295
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
11096
|
-
|
|
11296
|
+
pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
|
|
11097
11297
|
pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
|
|
11098
11298
|
}
|
|
11099
|
-
|
|
11100
|
-
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
11299
|
+
|
|
11101
11300
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
11102
11301
|
const isCreate = _$1.isBoolean(field.create) ? field.create : true;
|
|
11103
11302
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
@@ -11210,8 +11409,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11210
11409
|
pickerSchema.footerToolbar = ["pagination"];
|
|
11211
11410
|
}
|
|
11212
11411
|
|
|
11412
|
+
if(field.inlineHelpText){
|
|
11413
|
+
pickerSchema.toolbarClassName = "hasHelpText";
|
|
11414
|
+
pickerSchema.headerToolbar = [{
|
|
11415
|
+
"type": "tpl",
|
|
11416
|
+
"tpl": field.inlineHelpText,
|
|
11417
|
+
"className": "text-secondary"
|
|
11418
|
+
}, ...pickerSchema.headerToolbar];
|
|
11419
|
+
}
|
|
11420
|
+
pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
|
|
11421
|
+
|
|
11213
11422
|
const data = {
|
|
11214
11423
|
type: getAmisStaticFieldType('picker', readonly),
|
|
11424
|
+
className: ctx.className || '',
|
|
11215
11425
|
modalTitle: i18next.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
11216
11426
|
labelField: referenceTo.labelField.name,
|
|
11217
11427
|
valueField: referenceTo.valueField.name,
|
|
@@ -11285,6 +11495,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11285
11495
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11286
11496
|
let listView = getLookupListView(refObjectConfig);
|
|
11287
11497
|
|
|
11498
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11499
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11500
|
+
|
|
11288
11501
|
let sort = "";
|
|
11289
11502
|
if(listView){
|
|
11290
11503
|
sort = getListViewSort(listView);
|
|
@@ -11314,7 +11527,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11314
11527
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
11315
11528
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
11316
11529
|
apiInfo.requestAdaptor = `
|
|
11317
|
-
var filters = [];
|
|
11530
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
11318
11531
|
var top = 200;
|
|
11319
11532
|
if(api.data.$term){
|
|
11320
11533
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -11337,6 +11550,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11337
11550
|
}
|
|
11338
11551
|
|
|
11339
11552
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11553
|
+
|
|
11554
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11555
|
+
|
|
11556
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11557
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
11558
|
+
if(_filters0 && _filters0.length){
|
|
11559
|
+
filters.push(_filters0);
|
|
11560
|
+
}
|
|
11561
|
+
}
|
|
11562
|
+
|
|
11340
11563
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11341
11564
|
|
|
11342
11565
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11413,6 +11636,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11413
11636
|
// 但是同时配置autoComplete和source会多请求一次接口
|
|
11414
11637
|
// TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
|
|
11415
11638
|
data.source = apiInfo;
|
|
11639
|
+
delete data.autoComplete;
|
|
11416
11640
|
}
|
|
11417
11641
|
//删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
|
|
11418
11642
|
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
@@ -11459,7 +11683,8 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11459
11683
|
}
|
|
11460
11684
|
// console.log(`lookupToAmis====`, field, readonly, ctx)
|
|
11461
11685
|
if(readonly){
|
|
11462
|
-
if(field.reference_to){
|
|
11686
|
+
if(field.reference_to && !field.isTableField){
|
|
11687
|
+
//isTableField只在grid字段内存在
|
|
11463
11688
|
return {
|
|
11464
11689
|
type: 'steedos-field',
|
|
11465
11690
|
config: field,
|
|
@@ -11674,8 +11899,8 @@ if(typeof window != 'undefined'){
|
|
|
11674
11899
|
/*
|
|
11675
11900
|
* @Author: baozhoutao@steedos.com
|
|
11676
11901
|
* @Date: 2023-01-13 17:27:54
|
|
11677
|
-
* @LastEditors:
|
|
11678
|
-
* @LastEditTime:
|
|
11902
|
+
* @LastEditors: liaodaxue
|
|
11903
|
+
* @LastEditTime: 2024-02-04 17:29:54
|
|
11679
11904
|
* @Description:
|
|
11680
11905
|
*/
|
|
11681
11906
|
|
|
@@ -11776,7 +12001,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
11776
12001
|
"title": "Insert",
|
|
11777
12002
|
"items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
11778
12003
|
}
|
|
11779
|
-
}
|
|
12004
|
+
},
|
|
12005
|
+
"statusbar": false
|
|
11780
12006
|
},
|
|
11781
12007
|
"name": field.name
|
|
11782
12008
|
}
|
|
@@ -12121,13 +12347,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12121
12347
|
};
|
|
12122
12348
|
break;
|
|
12123
12349
|
case 'input-datetime-range':
|
|
12350
|
+
// convertData = {
|
|
12351
|
+
// type: "input-datetime-range",
|
|
12352
|
+
// inputFormat: 'YYYY-MM-DD HH:mm',
|
|
12353
|
+
// format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
12354
|
+
// tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
|
|
12355
|
+
// utc: true,
|
|
12356
|
+
// joinValues: false
|
|
12357
|
+
// }
|
|
12358
|
+
// 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
|
|
12124
12359
|
convertData = {
|
|
12125
|
-
type: "input-
|
|
12126
|
-
inputFormat:
|
|
12360
|
+
type: "input-date-range",
|
|
12361
|
+
inputFormat: "YYYY-MM-DD HH:mm",
|
|
12127
12362
|
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
12128
12363
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
12129
12364
|
utc: true,
|
|
12130
|
-
joinValues: false
|
|
12365
|
+
joinValues: false,
|
|
12366
|
+
"shortcuts": [
|
|
12367
|
+
"thismonth",
|
|
12368
|
+
"2monthsago",
|
|
12369
|
+
"3monthslater",
|
|
12370
|
+
"prevquarter",
|
|
12371
|
+
"thisquarter",
|
|
12372
|
+
"thisyear",
|
|
12373
|
+
"lastYear"
|
|
12374
|
+
]
|
|
12131
12375
|
};
|
|
12132
12376
|
break;
|
|
12133
12377
|
case 'datetime':
|
|
@@ -12178,7 +12422,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12178
12422
|
convertData = {
|
|
12179
12423
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
12180
12424
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
12181
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
12425
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
12182
12426
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
12183
12427
|
utc: true,
|
|
12184
12428
|
};
|
|
@@ -12309,6 +12553,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12309
12553
|
convertData = {
|
|
12310
12554
|
type: 'static-text'
|
|
12311
12555
|
};
|
|
12556
|
+
}else if(field.autonumber_enable_modify){
|
|
12557
|
+
convertData = {
|
|
12558
|
+
"type": "input-group",
|
|
12559
|
+
"body": [
|
|
12560
|
+
{
|
|
12561
|
+
"type": "input-text",
|
|
12562
|
+
"name": field.name
|
|
12563
|
+
},
|
|
12564
|
+
{
|
|
12565
|
+
"type": "button",
|
|
12566
|
+
"label": "自动获取",
|
|
12567
|
+
"actionType": "ajax",
|
|
12568
|
+
"api": {
|
|
12569
|
+
"url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
|
|
12570
|
+
"method": "post",
|
|
12571
|
+
"headers": {
|
|
12572
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12573
|
+
},
|
|
12574
|
+
"adaptor": `
|
|
12575
|
+
payload.data["${field.name}"] = payload.data && payload.data.autonumber;
|
|
12576
|
+
delete payload.data.autonumber;
|
|
12577
|
+
return payload;
|
|
12578
|
+
`
|
|
12579
|
+
},
|
|
12580
|
+
"messages": {
|
|
12581
|
+
"success": "获取成功"
|
|
12582
|
+
}
|
|
12583
|
+
}
|
|
12584
|
+
]
|
|
12585
|
+
};
|
|
12312
12586
|
}
|
|
12313
12587
|
break;
|
|
12314
12588
|
case 'url':
|
|
@@ -12514,12 +12788,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12514
12788
|
break;
|
|
12515
12789
|
}
|
|
12516
12790
|
if(!_$1.isEmpty(convertData)){
|
|
12791
|
+
const className = convertData.className;
|
|
12517
12792
|
if(field.is_wide || convertData.type === 'group'){
|
|
12518
|
-
convertData.className = 'col-span-2 m-0';
|
|
12793
|
+
convertData.className = className ? 'col-span-2 m-0 ' + className : 'col-span-2 m-0';
|
|
12519
12794
|
}else {
|
|
12520
|
-
convertData.className = 'm-0';
|
|
12795
|
+
convertData.className = className ? 'm-0 ' + className : 'm-0';
|
|
12521
12796
|
}
|
|
12522
|
-
if(readonly){
|
|
12797
|
+
if(readonly && ctx.mode !== 'edit'){
|
|
12523
12798
|
convertData.className = `${convertData.className} border-b`;
|
|
12524
12799
|
}
|
|
12525
12800
|
if(readonly){
|
|
@@ -12527,11 +12802,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12527
12802
|
}
|
|
12528
12803
|
|
|
12529
12804
|
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
12530
|
-
|
|
12531
|
-
convertData.className = convertData.className + fieldTypeClassName;
|
|
12532
|
-
} else {
|
|
12533
|
-
convertData.className = fieldTypeClassName;
|
|
12534
|
-
}
|
|
12805
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
12535
12806
|
|
|
12536
12807
|
if(field.visible_on && !ctx.inFilterForm){
|
|
12537
12808
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
@@ -12614,8 +12885,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
12614
12885
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
12615
12886
|
}
|
|
12616
12887
|
if(_field.type === 'datetime'){
|
|
12617
|
-
//
|
|
12618
|
-
|
|
12888
|
+
// 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
|
|
12889
|
+
// 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
|
|
12890
|
+
_field.type = 'input-datetime-range';
|
|
12619
12891
|
_field.is_wide = true;
|
|
12620
12892
|
fieldNamePrefix = `${fieldNamePrefix}between__`;
|
|
12621
12893
|
}
|
|
@@ -12801,6 +13073,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12801
13073
|
}
|
|
12802
13074
|
}
|
|
12803
13075
|
|
|
13076
|
+
fieldSetBody.forEach((field)=>{
|
|
13077
|
+
//判断label是否存在,不存在时将label的空占位元素隐藏
|
|
13078
|
+
if(!field.label){
|
|
13079
|
+
field.labelClassName = "none";
|
|
13080
|
+
}
|
|
13081
|
+
});
|
|
13082
|
+
|
|
12804
13083
|
// fieldSet 已支持显隐控制
|
|
12805
13084
|
const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12806
13085
|
let visible = visibleOn;
|
|
@@ -12923,12 +13202,130 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12923
13202
|
return await getSections(permissionFields, formFields, ctx);
|
|
12924
13203
|
}
|
|
12925
13204
|
|
|
13205
|
+
/*
|
|
13206
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
13207
|
+
* @Date: 2024-01-18 15:12:41
|
|
13208
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
13209
|
+
* @LastEditTime: 2024-01-18 15:12:49
|
|
13210
|
+
*/
|
|
13211
|
+
/**
|
|
13212
|
+
* 生成符合标准uuid格式的36位满足唯一性的随机串
|
|
13213
|
+
* @returns uuid
|
|
13214
|
+
*/
|
|
13215
|
+
function uuidv4() {
|
|
13216
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
|
|
13217
|
+
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
|
13218
|
+
);
|
|
13219
|
+
}
|
|
13220
|
+
|
|
12926
13221
|
/*
|
|
12927
13222
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12928
13223
|
* @Date: 2023-11-15 09:50:22
|
|
12929
13224
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12930
|
-
* @LastEditTime: 2024-01-
|
|
13225
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
13226
|
+
*/
|
|
13227
|
+
|
|
13228
|
+
/**
|
|
13229
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13230
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13231
|
+
* @param {*} value 子表组件字段值,数组
|
|
13232
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13233
|
+
* @returns 转换后的子表组件字段值
|
|
13234
|
+
*/
|
|
13235
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
13236
|
+
return (value || []).map((itemValue) => {
|
|
13237
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
13238
|
+
const newItemValue = clone(itemValue);
|
|
13239
|
+
(fields || []).forEach((itemField) => {
|
|
13240
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13241
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
13242
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
13243
|
+
newItemValue[itemField.name] = "";
|
|
13244
|
+
}
|
|
13245
|
+
if (newItemValue.children) {
|
|
13246
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
13247
|
+
}
|
|
13248
|
+
});
|
|
13249
|
+
return newItemValue;
|
|
13250
|
+
});
|
|
13251
|
+
}
|
|
13252
|
+
|
|
13253
|
+
/**
|
|
13254
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
13255
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13256
|
+
* @param {*} value 子表组件字段值,数组
|
|
13257
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13258
|
+
* @returns 转换后的子表组件字段值
|
|
12931
13259
|
*/
|
|
13260
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
13261
|
+
return (value || []).map((itemValue) => {
|
|
13262
|
+
const newItemValue = clone(itemValue);
|
|
13263
|
+
(fields || []).forEach((itemField) => {
|
|
13264
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13265
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
13266
|
+
delete newItemValue[itemField.name];
|
|
13267
|
+
}
|
|
13268
|
+
if (newItemValue.children) {
|
|
13269
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
13270
|
+
}
|
|
13271
|
+
});
|
|
13272
|
+
return newItemValue;
|
|
13273
|
+
});
|
|
13274
|
+
}
|
|
13275
|
+
|
|
13276
|
+
function getTablePrimaryKey(props) {
|
|
13277
|
+
return props.primaryKey || "_id";
|
|
13278
|
+
}
|
|
13279
|
+
|
|
13280
|
+
/**
|
|
13281
|
+
* 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
|
|
13282
|
+
* @param {*} value 子表组件字段值,数组
|
|
13283
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
13284
|
+
* @returns 转换后的子表组件字段值
|
|
13285
|
+
*/
|
|
13286
|
+
function getTableValueWithPrimaryKeyValue(value, primaryKey) {
|
|
13287
|
+
if (!primaryKey) {
|
|
13288
|
+
return value;
|
|
13289
|
+
}
|
|
13290
|
+
return (value || []).map((itemValue) => {
|
|
13291
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
|
|
13292
|
+
const newItemValue = clone(itemValue);
|
|
13293
|
+
if (newItemValue[primaryKey]) {
|
|
13294
|
+
if (newItemValue.children) {
|
|
13295
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13296
|
+
}
|
|
13297
|
+
return newItemValue;
|
|
13298
|
+
}
|
|
13299
|
+
else {
|
|
13300
|
+
newItemValue[primaryKey] = uuidv4();
|
|
13301
|
+
if (newItemValue.children) {
|
|
13302
|
+
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13303
|
+
}
|
|
13304
|
+
return newItemValue;
|
|
13305
|
+
}
|
|
13306
|
+
});
|
|
13307
|
+
}
|
|
13308
|
+
|
|
13309
|
+
/**
|
|
13310
|
+
* 子表组件字段值中每行数据的移除唯一标识字段值,因为该字段值一般只作临时标记,不存库
|
|
13311
|
+
* @param {*} value 子表组件字段值,数组
|
|
13312
|
+
* @param {*} primaryKey 主键字段名,一般为_id
|
|
13313
|
+
* @returns 转换后的子表组件字段值
|
|
13314
|
+
*/
|
|
13315
|
+
function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
|
|
13316
|
+
if (!primaryKey) {
|
|
13317
|
+
return value;
|
|
13318
|
+
}
|
|
13319
|
+
return (value || []).map((itemValue) => {
|
|
13320
|
+
//这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
|
|
13321
|
+
const newItemValue = clone(itemValue);
|
|
13322
|
+
if (newItemValue.children) {
|
|
13323
|
+
newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13324
|
+
}
|
|
13325
|
+
delete newItemValue[primaryKey];
|
|
13326
|
+
return newItemValue;
|
|
13327
|
+
});
|
|
13328
|
+
}
|
|
12932
13329
|
|
|
12933
13330
|
/**
|
|
12934
13331
|
* 子表组件字段值中每行数据的键值key移除指定前缀
|
|
@@ -12936,12 +13333,14 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12936
13333
|
* @param {*} fieldPrefix 字段前缀
|
|
12937
13334
|
* @returns 转换后的子表组件字段值
|
|
12938
13335
|
*/
|
|
12939
|
-
function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
13336
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
12940
13337
|
let convertedValue = [];
|
|
12941
|
-
(value || []).forEach((itemValue)=>{
|
|
13338
|
+
(value || []).forEach((itemValue) => {
|
|
12942
13339
|
var newItemValue = {};
|
|
12943
|
-
for(let n in itemValue){
|
|
12944
|
-
|
|
13340
|
+
for (let n in itemValue) {
|
|
13341
|
+
if (itemValue.hasOwnProperty(n)) {
|
|
13342
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
13343
|
+
}
|
|
12945
13344
|
}
|
|
12946
13345
|
convertedValue.push(newItemValue);
|
|
12947
13346
|
});
|
|
@@ -12952,17 +13351,21 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
|
12952
13351
|
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
12953
13352
|
* @param {*} value 子表组件字段值,数组
|
|
12954
13353
|
* @param {*} fieldPrefix 字段前缀
|
|
13354
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
12955
13355
|
* @returns 转换后的子表组件字段值
|
|
12956
13356
|
*/
|
|
12957
|
-
function getTableValuePrependFieldPrefix(value, fieldPrefix){
|
|
13357
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
12958
13358
|
let convertedValue = [];
|
|
12959
|
-
(value || []).forEach((itemValue)=>{
|
|
13359
|
+
(value || []).forEach((itemValue) => {
|
|
12960
13360
|
var newItemValue = {};
|
|
12961
|
-
for(let n in itemValue){
|
|
12962
|
-
if(typeof itemValue[n] !== undefined){
|
|
13361
|
+
for (let n in itemValue) {
|
|
13362
|
+
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
12963
13363
|
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
12964
13364
|
}
|
|
12965
13365
|
}
|
|
13366
|
+
if (primaryKey && itemValue[primaryKey]) {
|
|
13367
|
+
newItemValue[primaryKey] = itemValue[primaryKey];
|
|
13368
|
+
}
|
|
12966
13369
|
convertedValue.push(newItemValue);
|
|
12967
13370
|
});
|
|
12968
13371
|
return convertedValue;
|
|
@@ -12974,7 +13377,7 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix){
|
|
|
12974
13377
|
* @param {*} fieldPrefix 字段前缀
|
|
12975
13378
|
* @returns 转换后的子表组件字段值
|
|
12976
13379
|
*/
|
|
12977
|
-
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
13380
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
12978
13381
|
return (fields || []).map((item) => {
|
|
12979
13382
|
const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
12980
13383
|
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
@@ -12987,7 +13390,12 @@ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
|
12987
13390
|
* @param {*} mode edit/new/readonly
|
|
12988
13391
|
*/
|
|
12989
13392
|
function getFormFields(props, mode = "edit") {
|
|
12990
|
-
|
|
13393
|
+
let fieldPrefix = props.fieldPrefix;
|
|
13394
|
+
let fields = props.fields || [];
|
|
13395
|
+
if (fieldPrefix) {
|
|
13396
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13397
|
+
}
|
|
13398
|
+
return (fields || []).map(function (item) {
|
|
12991
13399
|
let formItem = {
|
|
12992
13400
|
"type": "steedos-field",
|
|
12993
13401
|
"name": item.name,
|
|
@@ -13007,6 +13415,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13007
13415
|
name: field.name,
|
|
13008
13416
|
quickEdit: {
|
|
13009
13417
|
"type": "steedos-field",
|
|
13418
|
+
"mode": "inline",
|
|
13010
13419
|
"config": Object.assign({}, field, {
|
|
13011
13420
|
label: false
|
|
13012
13421
|
})
|
|
@@ -13059,7 +13468,12 @@ async function getInputTableColumns(props) {
|
|
|
13059
13468
|
let inlineEditMode = props.inlineEditMode;
|
|
13060
13469
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
13061
13470
|
// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
13062
|
-
|
|
13471
|
+
|
|
13472
|
+
let fieldPrefix = props.fieldPrefix;
|
|
13473
|
+
let fields = props.fields || [];
|
|
13474
|
+
if (fieldPrefix) {
|
|
13475
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13476
|
+
}
|
|
13063
13477
|
if (columns && columns.length) {
|
|
13064
13478
|
return columns.map(function (column) {
|
|
13065
13479
|
let field, extendColumnProps = {};
|
|
@@ -13081,8 +13495,26 @@ async function getInputTableColumns(props) {
|
|
|
13081
13495
|
}
|
|
13082
13496
|
}
|
|
13083
13497
|
if (field) {
|
|
13084
|
-
let
|
|
13085
|
-
|
|
13498
|
+
let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
|
|
13499
|
+
extendColumnProps.inlineEditMode : showAsInlineEditMode;
|
|
13500
|
+
let tableCell = getInputTableCell(field, mode);
|
|
13501
|
+
let className = "";
|
|
13502
|
+
//判断是否换行,目前规则默认换行
|
|
13503
|
+
if(extendColumnProps.wrap != true){
|
|
13504
|
+
className += " whitespace-nowrap ";
|
|
13505
|
+
}else {
|
|
13506
|
+
className += " break-words ";
|
|
13507
|
+
}
|
|
13508
|
+
//合并classname
|
|
13509
|
+
if (typeof extendColumnProps.className == "object") {
|
|
13510
|
+
className = {
|
|
13511
|
+
[className]: "true",
|
|
13512
|
+
...extendColumnProps.className
|
|
13513
|
+
};
|
|
13514
|
+
} else if (typeof extendColumnProps.className == "string") {
|
|
13515
|
+
className = `${className} ${extendColumnProps.className} `;
|
|
13516
|
+
}
|
|
13517
|
+
return Object.assign({}, tableCell, extendColumnProps, {className});
|
|
13086
13518
|
}
|
|
13087
13519
|
else {
|
|
13088
13520
|
return column;
|
|
@@ -13092,6 +13524,7 @@ async function getInputTableColumns(props) {
|
|
|
13092
13524
|
else {
|
|
13093
13525
|
return fields.map(function (field) {
|
|
13094
13526
|
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
13527
|
+
tableCell.className = " whitespace-nowrap ";
|
|
13095
13528
|
return tableCell;
|
|
13096
13529
|
}) || [];
|
|
13097
13530
|
}
|
|
@@ -13104,7 +13537,7 @@ async function getInputTableColumns(props) {
|
|
|
13104
13537
|
*/
|
|
13105
13538
|
function getFormPagination(props, mode) {
|
|
13106
13539
|
let showPagination = true;
|
|
13107
|
-
if(mode === "new" && !!!props.editable){
|
|
13540
|
+
if (mode === "new" && !!!props.editable) {
|
|
13108
13541
|
//不允许编辑只允许新建时不应该让用户操作翻页
|
|
13109
13542
|
showPagination = false;
|
|
13110
13543
|
}
|
|
@@ -13120,35 +13553,41 @@ function getFormPagination(props, mode) {
|
|
|
13120
13553
|
let __formId = "${formId}";
|
|
13121
13554
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
13122
13555
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
13556
|
+
let mode = "${mode}";
|
|
13123
13557
|
// event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
|
|
13124
13558
|
// 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
|
|
13125
13559
|
// 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
|
|
13126
13560
|
// let currentPage = currentIndex + 1;
|
|
13127
13561
|
let currentPage = event.data.__page;
|
|
13128
13562
|
let currentIndex = event.data.index;
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
|
|
13135
|
-
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13563
|
+
if(mode !== "readonly"){
|
|
13564
|
+
// 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
|
|
13565
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
13566
|
+
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
13567
|
+
// 这里不clone的话,其值会带上__super属性
|
|
13568
|
+
currentFormValues = _.clone(currentFormValues);
|
|
13569
|
+
var parent = event.data.parent;
|
|
13570
|
+
var __parentIndex = event.data.__parentIndex;
|
|
13571
|
+
if(parent){
|
|
13572
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
13573
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
13574
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
13575
|
+
children: fieldValue[__parentIndex].children,
|
|
13576
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
13577
|
+
});
|
|
13578
|
+
}
|
|
13579
|
+
else{
|
|
13580
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
13581
|
+
}
|
|
13582
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
13583
|
+
doAction({
|
|
13584
|
+
"componentId": "${props.id}",
|
|
13585
|
+
"actionType": "setValue",
|
|
13586
|
+
"args": {
|
|
13587
|
+
"value": fieldValue
|
|
13588
|
+
}
|
|
13139
13589
|
});
|
|
13140
13590
|
}
|
|
13141
|
-
else{
|
|
13142
|
-
fieldValue[currentIndex] = currentFormValues;
|
|
13143
|
-
}
|
|
13144
|
-
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
13145
|
-
doAction({
|
|
13146
|
-
"componentId": "${props.id}",
|
|
13147
|
-
"actionType": "setValue",
|
|
13148
|
-
"args": {
|
|
13149
|
-
"value": fieldValue
|
|
13150
|
-
}
|
|
13151
|
-
});
|
|
13152
13591
|
|
|
13153
13592
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
13154
13593
|
let targetPage;
|
|
@@ -13197,9 +13636,14 @@ function getFormPagination(props, mode) {
|
|
|
13197
13636
|
"onEvent": {
|
|
13198
13637
|
"click": {
|
|
13199
13638
|
"actions": [
|
|
13639
|
+
{
|
|
13640
|
+
"actionType": "validate",
|
|
13641
|
+
"componentId": formId
|
|
13642
|
+
},
|
|
13200
13643
|
{
|
|
13201
13644
|
"actionType": "custom",
|
|
13202
|
-
"script": onPageChangeScript
|
|
13645
|
+
"script": onPageChangeScript,
|
|
13646
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13203
13647
|
}
|
|
13204
13648
|
]
|
|
13205
13649
|
}
|
|
@@ -13208,7 +13652,7 @@ function getFormPagination(props, mode) {
|
|
|
13208
13652
|
{
|
|
13209
13653
|
"type": "tpl",
|
|
13210
13654
|
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
13211
|
-
"tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
|
|
13655
|
+
"tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
|
|
13212
13656
|
},
|
|
13213
13657
|
{
|
|
13214
13658
|
"type": "button",
|
|
@@ -13218,15 +13662,20 @@ function getFormPagination(props, mode) {
|
|
|
13218
13662
|
"pageChangeDirection": "next",
|
|
13219
13663
|
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
13220
13664
|
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
13221
|
-
"disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
|
|
13665
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
|
|
13222
13666
|
"size": "sm",
|
|
13223
13667
|
"id": buttonNextId,
|
|
13224
13668
|
"onEvent": {
|
|
13225
13669
|
"click": {
|
|
13226
13670
|
"actions": [
|
|
13671
|
+
{
|
|
13672
|
+
"actionType": "validate",
|
|
13673
|
+
"componentId": formId
|
|
13674
|
+
},
|
|
13227
13675
|
{
|
|
13228
13676
|
"actionType": "custom",
|
|
13229
|
-
"script": onPageChangeScript
|
|
13677
|
+
"script": onPageChangeScript,
|
|
13678
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13230
13679
|
}
|
|
13231
13680
|
]
|
|
13232
13681
|
}
|
|
@@ -13247,6 +13696,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13247
13696
|
// console.log("==getFormPaginationWrapper===", props, mode);
|
|
13248
13697
|
let serviceId = getComponentId("form_pagination", props.id);
|
|
13249
13698
|
let tableServiceId = getComponentId("table_service", props.id);
|
|
13699
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
13250
13700
|
let innerForm = Object.assign({}, form, {
|
|
13251
13701
|
"data": {
|
|
13252
13702
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
@@ -13274,7 +13724,6 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13274
13724
|
}
|
|
13275
13725
|
];
|
|
13276
13726
|
let onServiceInitedScript = `
|
|
13277
|
-
|
|
13278
13727
|
// 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
13279
13728
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
13280
13729
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
@@ -13288,13 +13737,13 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13288
13737
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
13289
13738
|
// 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
|
|
13290
13739
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
13291
|
-
let fieldPrefix = "${props.fieldPrefix}";
|
|
13740
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
13292
13741
|
if(fieldPrefix){
|
|
13293
13742
|
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
13294
13743
|
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
13295
13744
|
}
|
|
13296
13745
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
13297
|
-
let mode = "${mode}";
|
|
13746
|
+
let mode = "${mode || ''}";
|
|
13298
13747
|
if(mode === "new"){
|
|
13299
13748
|
// 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
|
|
13300
13749
|
// 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
|
|
@@ -13320,10 +13769,20 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13320
13769
|
var fieldValue = event.data.__tableItems;
|
|
13321
13770
|
if(parent){
|
|
13322
13771
|
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
13323
|
-
var primaryKey = "${
|
|
13772
|
+
var primaryKey = "${primaryKey}";
|
|
13324
13773
|
event.data.__parentIndex = _.findIndex(fieldValue, function(item){
|
|
13325
13774
|
return item[primaryKey] == parent[primaryKey];
|
|
13326
13775
|
});
|
|
13776
|
+
if(event.data.__parentIndex < 0){
|
|
13777
|
+
let tableId = "${props.id}";
|
|
13778
|
+
let table = scope.getComponentById(tableId)
|
|
13779
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
13780
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
13781
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
13782
|
+
event.data.__parentIndex = _.findIndex(table.props.value, function(item){
|
|
13783
|
+
return item[primaryKey] == parent[primaryKey];
|
|
13784
|
+
});
|
|
13785
|
+
}
|
|
13327
13786
|
}
|
|
13328
13787
|
`;
|
|
13329
13788
|
let schema = {
|
|
@@ -13372,6 +13831,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13372
13831
|
async function getForm(props, mode = "edit", formId) {
|
|
13373
13832
|
let formFields = getFormFields(props, mode);
|
|
13374
13833
|
let body = await getFormBody(null, formFields);
|
|
13834
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
13375
13835
|
if (!formId) {
|
|
13376
13836
|
formId = getComponentId("form", props.id);
|
|
13377
13837
|
}
|
|
@@ -13390,6 +13850,18 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
13390
13850
|
// 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
|
|
13391
13851
|
let onEditItemSubmitScript = `
|
|
13392
13852
|
// let fieldValue = _.cloneDeep(event.data["${props.name}"]);
|
|
13853
|
+
let removeEmptyItems = function(items){
|
|
13854
|
+
let i = _.findIndex(items, function(item){
|
|
13855
|
+
return item === undefined
|
|
13856
|
+
});
|
|
13857
|
+
if(i > -1){
|
|
13858
|
+
items.splice(i, 1);
|
|
13859
|
+
removeEmptyItems(items);
|
|
13860
|
+
}
|
|
13861
|
+
}
|
|
13862
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
13863
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
13864
|
+
removeEmptyItems(event.data.__tableItems);
|
|
13393
13865
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
13394
13866
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
13395
13867
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
@@ -13398,6 +13870,8 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
13398
13870
|
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
13399
13871
|
var parent = event.data.__super.__super.parent;
|
|
13400
13872
|
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
13873
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
13874
|
+
var primaryKey = "${primaryKey}";
|
|
13401
13875
|
if(parent){
|
|
13402
13876
|
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
13403
13877
|
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
@@ -13407,6 +13881,8 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
13407
13881
|
});
|
|
13408
13882
|
}
|
|
13409
13883
|
else{
|
|
13884
|
+
// 这里currentFormValues中如果没有primaryKey字段值不用处理,因为组件的pipeIn/pipeOut中会为每行自动生成
|
|
13885
|
+
// 也不用担心复制行时_id会重复,因为点击复制按钮时已经处理过了
|
|
13410
13886
|
fieldValue[currentIndex] = currentFormValues;
|
|
13411
13887
|
}
|
|
13412
13888
|
doAction({
|
|
@@ -13504,13 +13980,14 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
13504
13980
|
*/
|
|
13505
13981
|
async function getButtonActions(props, mode) {
|
|
13506
13982
|
let actions = [];
|
|
13983
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
13507
13984
|
let formId = getComponentId("form", props.id);
|
|
13508
13985
|
let dialogId = getComponentId("dialog", props.id);
|
|
13509
13986
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
13510
13987
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
13511
13988
|
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
13512
13989
|
let amisVersion = getComparableAmisVersion();
|
|
13513
|
-
if(amisVersion < 3.6){
|
|
13990
|
+
if (amisVersion < 3.6) {
|
|
13514
13991
|
parentFormData = "${__super.__super || {}}";
|
|
13515
13992
|
}
|
|
13516
13993
|
if (mode == "new" || mode == "edit") {
|
|
@@ -13546,13 +14023,35 @@ async function getButtonActions(props, mode) {
|
|
|
13546
14023
|
// };
|
|
13547
14024
|
let onSaveAndNewItemScript = `
|
|
13548
14025
|
let scope = event.context.scoped;
|
|
14026
|
+
let removeEmptyItems = function(items){
|
|
14027
|
+
let i = _.findIndex(items, function(item){
|
|
14028
|
+
return item === undefined
|
|
14029
|
+
});
|
|
14030
|
+
if(i > -1){
|
|
14031
|
+
items.splice(i, 1);
|
|
14032
|
+
removeEmptyItems(items);
|
|
14033
|
+
}
|
|
14034
|
+
}
|
|
14035
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
14036
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
14037
|
+
removeEmptyItems(event.data.__tableItems);
|
|
13549
14038
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
13550
14039
|
// 新建一条空白行并保存到子表组件
|
|
13551
14040
|
var parent = event.data.__super.parent;
|
|
13552
|
-
var primaryKey = "${
|
|
14041
|
+
var primaryKey = "${primaryKey}";
|
|
13553
14042
|
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
13554
14043
|
return item[primaryKey] == parent[primaryKey];
|
|
13555
14044
|
});
|
|
14045
|
+
if(parent && __parentIndex < 0){
|
|
14046
|
+
let tableId = "${props.id}";
|
|
14047
|
+
let table = scope.getComponentById(tableId)
|
|
14048
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
14049
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
14050
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
14051
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
14052
|
+
return item[primaryKey] == parent[primaryKey];
|
|
14053
|
+
});
|
|
14054
|
+
}
|
|
13556
14055
|
if(parent){
|
|
13557
14056
|
fieldValue[__parentIndex].children.push({});
|
|
13558
14057
|
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
@@ -13586,14 +14085,42 @@ async function getButtonActions(props, mode) {
|
|
|
13586
14085
|
let __formId = "${formId}";
|
|
13587
14086
|
// let newItem = JSON.parse(JSON.stringify(event.data));
|
|
13588
14087
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
14088
|
+
newItem = _.clone(newItem);
|
|
14089
|
+
let removeEmptyItems = function(items){
|
|
14090
|
+
let i = _.findIndex(items, function(item){
|
|
14091
|
+
return item === undefined
|
|
14092
|
+
});
|
|
14093
|
+
if(i > -1){
|
|
14094
|
+
items.splice(i, 1);
|
|
14095
|
+
removeEmptyItems(items);
|
|
14096
|
+
}
|
|
14097
|
+
}
|
|
14098
|
+
// 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
|
|
14099
|
+
// 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
|
|
14100
|
+
removeEmptyItems(event.data.__tableItems);
|
|
13589
14101
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
13590
14102
|
// 复制当前页数据到新建行并保存到子表组件
|
|
13591
14103
|
// fieldValue.push(newItem);
|
|
13592
14104
|
var parent = event.data.__super.parent;
|
|
13593
|
-
var primaryKey = "${
|
|
14105
|
+
var primaryKey = "${primaryKey}";
|
|
13594
14106
|
var __parentIndex = parent && _.findIndex(fieldValue, function(item){
|
|
13595
14107
|
return item[primaryKey] == parent[primaryKey];
|
|
13596
14108
|
});
|
|
14109
|
+
if(parent && __parentIndex < 0){
|
|
14110
|
+
let tableId = "${props.id}";
|
|
14111
|
+
let table = scope.getComponentById(tableId)
|
|
14112
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
14113
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
14114
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
14115
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
14116
|
+
return item[primaryKey] == parent[primaryKey];
|
|
14117
|
+
});
|
|
14118
|
+
}
|
|
14119
|
+
if(newItem[primaryKey]){
|
|
14120
|
+
// 如果newItem已经有主键字段值,则重新生成新的主键值,否则会重复。
|
|
14121
|
+
let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
|
|
14122
|
+
newItem[primaryKey] = uuidv4();
|
|
14123
|
+
}
|
|
13597
14124
|
if(parent){
|
|
13598
14125
|
fieldValue[__parentIndex].children.push(newItem);
|
|
13599
14126
|
// 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
|
|
@@ -13624,13 +14151,13 @@ async function getButtonActions(props, mode) {
|
|
|
13624
14151
|
`;
|
|
13625
14152
|
let dialogButtons = [
|
|
13626
14153
|
{
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
14154
|
+
"type": "button",
|
|
14155
|
+
"label": "完成",
|
|
14156
|
+
"actionType": "confirm",
|
|
14157
|
+
"level": "primary"
|
|
13631
14158
|
}
|
|
13632
14159
|
];
|
|
13633
|
-
if(props.addable){
|
|
14160
|
+
if (props.addable) {
|
|
13634
14161
|
// 有新增行权限时额外添加新增和复制按钮
|
|
13635
14162
|
dialogButtons = [
|
|
13636
14163
|
{
|
|
@@ -13640,9 +14167,14 @@ async function getButtonActions(props, mode) {
|
|
|
13640
14167
|
"onEvent": {
|
|
13641
14168
|
"click": {
|
|
13642
14169
|
"actions": [
|
|
14170
|
+
{
|
|
14171
|
+
"actionType": "validate",
|
|
14172
|
+
"componentId": formId
|
|
14173
|
+
},
|
|
13643
14174
|
{
|
|
13644
14175
|
"actionType": "custom",
|
|
13645
|
-
"script": onSaveAndNewItemScript
|
|
14176
|
+
"script": onSaveAndNewItemScript,
|
|
14177
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13646
14178
|
}
|
|
13647
14179
|
]
|
|
13648
14180
|
}
|
|
@@ -13655,9 +14187,14 @@ async function getButtonActions(props, mode) {
|
|
|
13655
14187
|
"onEvent": {
|
|
13656
14188
|
"click": {
|
|
13657
14189
|
"actions": [
|
|
14190
|
+
{
|
|
14191
|
+
"actionType": "validate",
|
|
14192
|
+
"componentId": formId
|
|
14193
|
+
},
|
|
13658
14194
|
{
|
|
13659
14195
|
"actionType": "custom",
|
|
13660
|
-
"script": onSaveAndCopyItemScript
|
|
14196
|
+
"script": onSaveAndCopyItemScript,
|
|
14197
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13661
14198
|
}
|
|
13662
14199
|
]
|
|
13663
14200
|
}
|
|
@@ -13703,7 +14240,7 @@ async function getButtonActions(props, mode) {
|
|
|
13703
14240
|
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
13704
14241
|
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
13705
14242
|
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
13706
|
-
|
|
14243
|
+
},
|
|
13707
14244
|
"actions": dialogButtons,
|
|
13708
14245
|
"onEvent": {
|
|
13709
14246
|
"confirm": {
|
|
@@ -13801,7 +14338,10 @@ async function getButtonActions(props, mode) {
|
|
|
13801
14338
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
13802
14339
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
13803
14340
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
13804
|
-
"__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
14341
|
+
// "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
14342
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
14343
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
14344
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
13805
14345
|
},
|
|
13806
14346
|
}
|
|
13807
14347
|
}
|
|
@@ -13817,13 +14357,24 @@ async function getButtonActions(props, mode) {
|
|
|
13817
14357
|
let wrapperServiceData = wrapperService.getData();
|
|
13818
14358
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
13819
14359
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
14360
|
+
// 也因为这里clone没有直接删除,所以弹出编辑表单提交事件中event.data.__tableItems中取到的值会有被删除的行数据为undefined
|
|
13820
14361
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
13821
14362
|
var currentIndex = event.data.index;
|
|
13822
14363
|
var parent = event.data.__super.parent;
|
|
13823
|
-
var primaryKey = "${
|
|
14364
|
+
var primaryKey = "${primaryKey}";
|
|
13824
14365
|
var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
|
|
13825
14366
|
return item[primaryKey] == parent[primaryKey];
|
|
13826
14367
|
});
|
|
14368
|
+
if(parent && __parentIndex < 0){
|
|
14369
|
+
let tableId = "${props.id}";
|
|
14370
|
+
let table = scope.getComponentById(tableId)
|
|
14371
|
+
// autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
|
|
14372
|
+
// 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
|
|
14373
|
+
// 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
|
|
14374
|
+
__parentIndex = _.findIndex(table.props.value, function(item){
|
|
14375
|
+
return item[primaryKey] == parent[primaryKey];
|
|
14376
|
+
});
|
|
14377
|
+
}
|
|
13827
14378
|
if(parent){
|
|
13828
14379
|
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
13829
14380
|
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
@@ -13835,6 +14386,11 @@ async function getButtonActions(props, mode) {
|
|
|
13835
14386
|
else{
|
|
13836
14387
|
lastestFieldValue.splice(currentIndex, 1);
|
|
13837
14388
|
}
|
|
14389
|
+
let fieldPrefix = "${props.fieldPrefix || ''}";
|
|
14390
|
+
if(fieldPrefix){
|
|
14391
|
+
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
14392
|
+
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
14393
|
+
}
|
|
13838
14394
|
doAction({
|
|
13839
14395
|
"componentId": "${props.id}",
|
|
13840
14396
|
"actionType": "setValue",
|
|
@@ -13904,45 +14460,77 @@ async function getButtonView(props) {
|
|
|
13904
14460
|
|
|
13905
14461
|
async function getButtonDelete(props) {
|
|
13906
14462
|
return {
|
|
13907
|
-
"type": "button",
|
|
13908
|
-
"label": "",
|
|
13909
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
14463
|
+
"type": "dropdown-button",
|
|
13910
14464
|
"level": "link",
|
|
13911
|
-
"
|
|
13912
|
-
|
|
13913
|
-
|
|
14465
|
+
"icon": "fa fa-trash-alt",
|
|
14466
|
+
"size": "xs",
|
|
14467
|
+
"hideCaret": true,
|
|
14468
|
+
"closeOnClick": true,
|
|
14469
|
+
"body": [
|
|
14470
|
+
{
|
|
14471
|
+
"type": "wrapper",
|
|
14472
|
+
"size": "md",
|
|
14473
|
+
"className": "w-80",
|
|
14474
|
+
"body": [
|
|
14475
|
+
{
|
|
14476
|
+
"tpl": "确定要删除吗?",
|
|
14477
|
+
"type": "tpl"
|
|
14478
|
+
},
|
|
14479
|
+
{
|
|
14480
|
+
"type": "flex",
|
|
14481
|
+
"justify": "flex-end",
|
|
14482
|
+
"className": "mt-3",
|
|
14483
|
+
"items": [
|
|
14484
|
+
{
|
|
14485
|
+
"type": "button",
|
|
14486
|
+
"label": "取消",
|
|
14487
|
+
"className": "mr-2"
|
|
14488
|
+
},
|
|
14489
|
+
{
|
|
14490
|
+
"type": "button",
|
|
14491
|
+
"label": "删除",
|
|
14492
|
+
"level": "danger",
|
|
14493
|
+
"onEvent": {
|
|
14494
|
+
"click": {
|
|
14495
|
+
"actions": await getButtonActions(props, "delete")
|
|
14496
|
+
}
|
|
14497
|
+
}
|
|
14498
|
+
}
|
|
14499
|
+
]
|
|
14500
|
+
}
|
|
14501
|
+
]
|
|
13914
14502
|
}
|
|
13915
|
-
|
|
13916
|
-
}
|
|
14503
|
+
]
|
|
14504
|
+
}
|
|
13917
14505
|
}
|
|
13918
14506
|
|
|
14507
|
+
|
|
13919
14508
|
const getAmisInputTableSchema = async (props) => {
|
|
13920
14509
|
if (!props.id) {
|
|
13921
14510
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
13922
14511
|
}
|
|
13923
|
-
|
|
13924
|
-
props.primaryKey = "_id";
|
|
13925
|
-
}
|
|
14512
|
+
let primaryKey = getTablePrimaryKey(props);
|
|
13926
14513
|
let showOperation = props.showOperation;
|
|
13927
|
-
if(showOperation !== false){
|
|
14514
|
+
if (showOperation !== false) {
|
|
13928
14515
|
showOperation = true;
|
|
13929
14516
|
}
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
14517
|
+
let fieldPrefix = props.fieldPrefix;
|
|
14518
|
+
let fields = props.fields || [];
|
|
14519
|
+
if (fieldPrefix) {
|
|
14520
|
+
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13933
14521
|
}
|
|
13934
14522
|
let serviceId = getComponentId("table_service", props.id);
|
|
13935
14523
|
let buttonsForColumnOperations = [];
|
|
13936
14524
|
let inlineEditMode = props.inlineEditMode;
|
|
13937
14525
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
13938
|
-
if(showOperation){
|
|
14526
|
+
if (showOperation) {
|
|
13939
14527
|
if (props.editable) {
|
|
13940
14528
|
let showEditButton = true;
|
|
13941
14529
|
if (showAsInlineEditMode) {
|
|
13942
14530
|
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
13943
14531
|
showEditButton = true;
|
|
13944
14532
|
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
13945
|
-
// if (props.columns && props.columns.length > 0 && props.columns.length <
|
|
14533
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
13946
14534
|
// showEditButton = true;
|
|
13947
14535
|
// }
|
|
13948
14536
|
// else {
|
|
@@ -13957,7 +14545,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13957
14545
|
}
|
|
13958
14546
|
else {
|
|
13959
14547
|
// 只读时显示查看按钮
|
|
13960
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length <
|
|
14548
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
13961
14549
|
let buttonViewSchema = await getButtonView(props);
|
|
13962
14550
|
buttonsForColumnOperations.push(buttonViewSchema);
|
|
13963
14551
|
}
|
|
@@ -13966,10 +14554,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13966
14554
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
13967
14555
|
}
|
|
13968
14556
|
}
|
|
13969
|
-
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
14557
|
+
let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
13970
14558
|
let inputTableSchema = {
|
|
13971
14559
|
"type": "input-table",
|
|
13972
|
-
"
|
|
14560
|
+
"mode": "normal",
|
|
13973
14561
|
"name": props.name,
|
|
13974
14562
|
//不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
|
|
13975
14563
|
// "addable": props.addable,
|
|
@@ -13985,36 +14573,53 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13985
14573
|
"showTableAddBtn": false,
|
|
13986
14574
|
"showFooterAddBtn": false,
|
|
13987
14575
|
"className": props.tableClassName,
|
|
14576
|
+
"pipeIn": (value, data) => {
|
|
14577
|
+
if (fieldPrefix) {
|
|
14578
|
+
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
14579
|
+
}
|
|
14580
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
14581
|
+
if (primaryKey) {
|
|
14582
|
+
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
14583
|
+
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
14584
|
+
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
14585
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
14586
|
+
}
|
|
14587
|
+
if (amis.pipeIn) {
|
|
14588
|
+
if (typeof amis.pipeIn === 'function') {
|
|
14589
|
+
return amis.pipeIn(value, data);
|
|
14590
|
+
}
|
|
14591
|
+
}
|
|
14592
|
+
return value;
|
|
14593
|
+
},
|
|
13988
14594
|
"pipeOut": (value, data) => {
|
|
13989
|
-
value = (value || []).map(function(item){
|
|
14595
|
+
value = (value || []).map(function (item) {
|
|
13990
14596
|
delete item.__fix_rerender_after_children_modified_tag;
|
|
13991
14597
|
return item;
|
|
13992
14598
|
});
|
|
13993
|
-
if(
|
|
13994
|
-
value = getTableValuePrependFieldPrefix(value,
|
|
14599
|
+
if (fieldPrefix) {
|
|
14600
|
+
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
14601
|
+
}
|
|
14602
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
14603
|
+
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
14604
|
+
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
14605
|
+
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
14606
|
+
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
13995
14607
|
}
|
|
13996
|
-
|
|
13997
|
-
|
|
14608
|
+
else {
|
|
14609
|
+
// 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
|
|
14610
|
+
// 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
|
|
14611
|
+
// 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
|
|
14612
|
+
// 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
|
|
14613
|
+
value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
|
|
14614
|
+
}
|
|
14615
|
+
if (amis.pipeOut) {
|
|
14616
|
+
if (typeof amis.pipeOut === 'function') {
|
|
13998
14617
|
return amis.pipeOut(value, data);
|
|
13999
14618
|
}
|
|
14000
14619
|
}
|
|
14001
14620
|
return value;
|
|
14002
14621
|
}
|
|
14003
14622
|
};
|
|
14004
|
-
if(amis.pipeIn){
|
|
14005
|
-
inputTableSchema.pipeIn = amis.pipeIn;
|
|
14006
|
-
}
|
|
14007
|
-
if(props.fieldPrefix){
|
|
14008
|
-
inputTableSchema.pipeIn = (value, data) => {
|
|
14009
|
-
value = getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
14010
|
-
if(amis.pipeIn){
|
|
14011
|
-
if(typeof amis.pipeIn === 'function'){
|
|
14012
|
-
return amis.pipeIn(value, data);
|
|
14013
|
-
}
|
|
14014
|
-
}
|
|
14015
|
-
return value;
|
|
14016
|
-
};
|
|
14017
|
-
}
|
|
14018
14623
|
if (buttonsForColumnOperations.length) {
|
|
14019
14624
|
inputTableSchema.columns.push({
|
|
14020
14625
|
"name": "__op__",
|
|
@@ -14023,9 +14628,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14023
14628
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
14024
14629
|
});
|
|
14025
14630
|
}
|
|
14026
|
-
if (showAsInlineEditMode) {
|
|
14027
|
-
|
|
14028
|
-
|
|
14631
|
+
// if (showAsInlineEditMode) {
|
|
14632
|
+
// // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
|
|
14633
|
+
// inputTableSchema.needConfirm = false;
|
|
14634
|
+
// }
|
|
14029
14635
|
if (amis) {
|
|
14030
14636
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
14031
14637
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
@@ -14033,7 +14639,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14033
14639
|
delete amis.pipeOut;//该属性在上面合并过了
|
|
14034
14640
|
Object.assign(inputTableSchema, amis);
|
|
14035
14641
|
}
|
|
14036
|
-
const isAnyFieldHasDependOn = (
|
|
14642
|
+
const isAnyFieldHasDependOn = (fields || []).find(function (item) {
|
|
14037
14643
|
return item.depend_on;
|
|
14038
14644
|
});
|
|
14039
14645
|
if (isAnyFieldHasDependOn) {
|
|
@@ -14066,11 +14672,31 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14066
14672
|
"body": headerToolbar
|
|
14067
14673
|
});
|
|
14068
14674
|
}
|
|
14675
|
+
let className = "steedos-input-table";
|
|
14676
|
+
|
|
14677
|
+
if (typeof props.className == "object") {
|
|
14678
|
+
className = {
|
|
14679
|
+
[className]: "true",
|
|
14680
|
+
...props.className
|
|
14681
|
+
};
|
|
14682
|
+
} else if (typeof props.className == "string") {
|
|
14683
|
+
className = `${className} ${props.className} `;
|
|
14684
|
+
}
|
|
14685
|
+
|
|
14069
14686
|
let schema = {
|
|
14070
|
-
"type": "
|
|
14071
|
-
"body":
|
|
14072
|
-
|
|
14073
|
-
|
|
14687
|
+
"type": "control",
|
|
14688
|
+
"body": {
|
|
14689
|
+
"type": "service",
|
|
14690
|
+
"body": schemaBody,
|
|
14691
|
+
"id": serviceId
|
|
14692
|
+
},
|
|
14693
|
+
"label": props.label,
|
|
14694
|
+
"labelClassName": props.label ? props.labelClassName : "none",
|
|
14695
|
+
"labelRemark": props.labelRemark,
|
|
14696
|
+
"labelAlign": props.labelAlign,
|
|
14697
|
+
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14698
|
+
"mode": props.mode || null,
|
|
14699
|
+
className
|
|
14074
14700
|
};
|
|
14075
14701
|
// console.log("===schema===", schema);
|
|
14076
14702
|
return schema;
|