@steedos/service-plugin-amis 2.2.25 → 2.2.28
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.
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-04-27 10:07:56
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const objectql = require("@steedos/objectql");
|
|
8
|
+
const steedosI18n = require("@steedos/i18n");
|
|
9
|
+
const _ = require("underscore");
|
|
10
|
+
const clone = require("clone");
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
name: "amis-metadata-listviews",
|
|
14
|
+
mixins: [],
|
|
15
|
+
/**
|
|
16
|
+
* Settings
|
|
17
|
+
*/
|
|
18
|
+
settings: {},
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Dependencies
|
|
22
|
+
*/
|
|
23
|
+
dependencies: [],
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Actions
|
|
27
|
+
*/
|
|
28
|
+
actions: {
|
|
29
|
+
getFilterFields: {
|
|
30
|
+
rest: {
|
|
31
|
+
method: "GET",
|
|
32
|
+
path: "/getFilterFields",
|
|
33
|
+
},
|
|
34
|
+
async handler(ctx) {
|
|
35
|
+
return await this.getObjects(ctx);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Events
|
|
42
|
+
*/
|
|
43
|
+
events: {},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Methods
|
|
47
|
+
*/
|
|
48
|
+
methods: {
|
|
49
|
+
getFilterFields: {
|
|
50
|
+
async handler(ctx) {
|
|
51
|
+
const userSession = ctx.meta.user;
|
|
52
|
+
const { objectName } = ctx.params;
|
|
53
|
+
const lng = userSession.language || "zh-CN";
|
|
54
|
+
const spaceId = userSession.spaceId;
|
|
55
|
+
const objectConfig = await objectql.getObjectConfig(objectName);
|
|
56
|
+
|
|
57
|
+
steedosI18n.translationObject(lng, object.name, object);
|
|
58
|
+
|
|
59
|
+
const fields = [];
|
|
60
|
+
_.each(objectConfig.fields, (field) => {
|
|
61
|
+
switch (field.type) {
|
|
62
|
+
case 'text':
|
|
63
|
+
fields.push({
|
|
64
|
+
label: field.label,
|
|
65
|
+
type: field.type,
|
|
66
|
+
name: field.name,
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
case 'number':
|
|
70
|
+
fields.push({
|
|
71
|
+
label: field.label,
|
|
72
|
+
type: field.type,
|
|
73
|
+
name: field.name,
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
case 'date':
|
|
77
|
+
fields.push({
|
|
78
|
+
label: field.label,
|
|
79
|
+
type: field.type,
|
|
80
|
+
name: field.name,
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
case 'datetime':
|
|
84
|
+
fields.push({
|
|
85
|
+
label: field.label,
|
|
86
|
+
type: field.type,
|
|
87
|
+
name: field.name,
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
case 'time':
|
|
91
|
+
fields.push({
|
|
92
|
+
label: field.label,
|
|
93
|
+
type: field.type,
|
|
94
|
+
name: field.name,
|
|
95
|
+
});
|
|
96
|
+
break;
|
|
97
|
+
case 'select':
|
|
98
|
+
fields.push({
|
|
99
|
+
label: field.label,
|
|
100
|
+
type: field.type,
|
|
101
|
+
name: field.name,
|
|
102
|
+
source: "/amis/api/mock2/form/getOptions?waitSeconds=1", //TODO
|
|
103
|
+
searchable: true
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return objects;
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-plugin-amis",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.28",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "1e8d08ae4d525950194e35984cd5851016a03219"
|
|
12
12
|
}
|