1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
var plugin = require('topsin.gengui');
var gui = plugin.newGui(plugin.__dirname);
function gen() {
this.PAUSE = function() {
console.log("pause");
}
}
gui.setLang("zhtw"); // zhcn, zhtw, en
r = gui.showForm({
title: "注册账号",
size: [600, 400],
ui: function func(self) {
return [{
type: 'ScrollArea',
property: {
widget_resizable: true,
frame_shape: 'NoFrame',
align: 'Top'
},
child: {
type: 'VBoxLayout',
property: {
margin: 2,
spacing: 20,
align: 'Top'
},
pack: {
stretch: 0
},
child: [{
type: "FormGridLayout",
property: {
columns: 1,
label_alignment: 'Top | Right',
margin: 10,
spacing: 20
},
pack: {
stretch: 0
},
child: [
{
name: 'table',
type: 'TableView',
property: {},
initCallback: function (obj, self) {
obj.setDataKeyList(["id", "analysis_item", "analysis_result", "result", "standard", "remark"]);
obj.setHeaderItem(
[
{},
{ name: 'analysis_item', display: 'Analysis Item', resizeMode: 'ResizeToContents', displayRole: '$analysis_item' },
{ name: 'analysis_result', display: 'Analysis Result', resizeMode: 'ResizeToContents', displayRole: '$analysis_result' },
{ name: 'result', display: 'Result', resizeMode: 'ResizeToContents', displayRole: '$result' },
{ name: 'standard', display: 'Standard', resizeMode: 'ResizeToContents', displayRole: '$standard' },
{ name: 'remark', display: 'Remark', resizeMode: 'ResizeToContents', displayRole: '$remark', editRole: '$remark', flagsRole: 'ItemIsEditable|ItemIsEnabled|ItemIsSelectable' }
]
);
obj.setPrimaryKey("id");
},
setter: function (obj, value, self) {
if (value != null) {
obj.loadData(value);
} else {
obj.clearData();
}
},
getter: function (obj, self) {
return obj.allDataMap();
}
}
]
}]
}
}];
},
data: {
table: [
{
"id": 1,
"analysis_item": "test",
"analysis_result": "test",
"result": "test",
"standard": "test",
"remark": "test"
}
]
},
includehide: false,
buttons: [{
stock: "ok",
sensitive: true,
command: function (data) {
}
},
{
stock: "cancel",
sensitive: true,
command: function (ddata) {
}
},
{
stock: "help",
sensitive: true,
command: function (data) {
console.log(data);
}
}
],
hook: function (data) {},
gen: new gen()
});
console.log(r);