@ajaxjs/ui 1.2.1 → 1.2.3
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/README.md +8 -11
- package/dist/api-helper/common/arg.vue +46 -0
- package/dist/api-helper/common/http-method.vue +53 -0
- package/dist/api-helper/common/input-table.vue +128 -0
- package/dist/api-helper/document/document-render.d.ts +10 -0
- package/dist/api-helper/document/document-render.js +38 -0
- package/dist/api-helper/document/document-render.js.map +1 -0
- package/dist/api-helper/document/document-render.ts +35 -0
- package/dist/api-helper/document/document-render.vue +155 -0
- package/dist/api-helper/document/document.d.ts +31 -0
- package/dist/api-helper/document/document.js +55 -0
- package/dist/api-helper/document/document.js.map +1 -0
- package/dist/api-helper/document/document.ts +55 -0
- package/dist/api-helper/document/document.vue +78 -0
- package/dist/api-helper/document/perview.vue +0 -0
- package/dist/api-helper/index.js +142 -0
- package/dist/api-helper/index.vue +108 -0
- package/dist/api-helper/request-body.vue +66 -0
- package/dist/api-helper/table.d.ts +7 -0
- package/dist/api-helper/table.js +13 -0
- package/dist/api-helper/table.js.map +1 -0
- package/dist/api-helper/table.ts +10 -0
- package/dist/api-helper/table.vue +103 -0
- package/dist/api-helper/xhr.js +100 -0
- package/dist/api-selector/api-list-dataservice.d.ts +18 -0
- package/dist/api-selector/api-list-dataservice.js +209 -0
- package/dist/api-selector/api-list-dataservice.js.map +1 -0
- package/dist/api-selector/api-list-dataservice.ts +232 -0
- package/dist/api-selector/api-list-swagger.d.ts +28 -0
- package/dist/api-selector/api-list-swagger.js +179 -0
- package/dist/api-selector/api-list-swagger.js.map +1 -0
- package/dist/api-selector/api-list-swagger.ts +206 -0
- package/dist/api-selector/api-list.d.ts +80 -0
- package/dist/api-selector/api-list.js +129 -0
- package/dist/api-selector/api-list.js.map +1 -0
- package/dist/api-selector/api-list.ts +135 -0
- package/dist/api-selector/index.vue +125 -0
- package/dist/api-selector/test-dataservice.d.ts +23 -0
- package/dist/api-selector/test-dataservice.js +74 -0
- package/dist/api-selector/test-dataservice.js.map +1 -0
- package/dist/api-selector/test-swagger.d.ts +901 -0
- package/dist/api-selector/test-swagger.js +656 -0
- package/dist/api-selector/test-swagger.js.map +1 -0
- package/dist/data-source/data-source.css +44 -0
- package/dist/data-source/data-source.html +59 -0
- package/dist/data-source/data-source.js +96 -0
- package/dist/iView-ext/fast-iview-table/fast-iview-table.d.ts +37 -0
- package/dist/iView-ext/fast-iview-table/fast-iview-table.js +72 -0
- package/dist/iView-ext/fast-iview-table/fast-iview-table.js.map +1 -0
- package/dist/iView-ext/fast-iview-table/fast-iview-table.ts +75 -0
- package/dist/iView-ext/fast-iview-table/fast-iview-table.vue +52 -0
- package/dist/iView-ext/fast-iview-table/list.d.ts +44 -0
- package/dist/iView-ext/fast-iview-table/list.js +97 -0
- package/dist/iView-ext/fast-iview-table/list.js.map +1 -0
- package/dist/iView-ext/fast-iview-table/list.ts +109 -0
- package/dist/index.d.ts +35 -31
- package/dist/index.js +41 -56
- package/dist/index.js.map +1 -1
- package/dist/index.ts +58 -0
- package/dist/libs/api-helper.d.ts +194 -0
- package/dist/libs/api-list.d.ts +15 -0
- package/dist/libs/common.d.ts +201 -0
- package/dist/libs/entity.d.ts +26 -0
- package/dist/libs/entity.js +1 -0
- package/dist/libs/entity.js.map +1 -0
- package/dist/libs/entity.ts +31 -0
- package/dist/libs/iview-widgets.d.ts +59 -0
- package/dist/libs/iview-widgets.js +2 -0
- package/dist/libs/iview-widgets.js.map +1 -0
- package/dist/libs/iview-widgets.ts +73 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +16 -8
- package/dist/main.js.map +1 -1
- package/dist/main.ts +22 -0
- package/dist/table-selector/table-selector.htm +28 -0
- package/dist/table-selector/table-selector.js +149 -0
- package/package.json +15 -15
- package/dist/router/index.d.ts +0 -3
- package/dist/router/index.js +0 -44
- package/dist/router/index.js.map +0 -1
- package/dist/util/cookies.d.ts +0 -18
- package/dist/util/cookies.js +0 -46
- package/dist/util/cookies.js.map +0 -1
- package/dist/util/dom.d.ts +0 -17
- package/dist/util/dom.js +0 -44
- package/dist/util/dom.js.map +0 -1
- package/dist/util/utils.d.ts +0 -51
- package/dist/util/utils.js +0 -174
- package/dist/util/utils.js.map +0 -1
- package/dist/util/xhr-config.d.ts +0 -22
- package/dist/util/xhr-config.js +0 -3
- package/dist/util/xhr-config.js.map +0 -1
- package/dist/util/xhr.d.ts +0 -71
- package/dist/util/xhr.js +0 -262
- package/dist/util/xhr.js.map +0 -1
- package/dist/widget/AccordionMenu.vue +0 -140
- package/dist/widget/AdjustFontSize.vue +0 -65
- package/dist/widget/Article.vue +0 -59
- package/dist/widget/EmptyContent.d.ts +0 -5
- package/dist/widget/EmptyContent.js +0 -7
- package/dist/widget/EmptyContent.js.map +0 -1
- package/dist/widget/Expander.vue +0 -65
- package/dist/widget/FileUploader/FileUploader.d.ts +0 -70
- package/dist/widget/FileUploader/FileUploader.js +0 -139
- package/dist/widget/FileUploader/FileUploader.js.map +0 -1
- package/dist/widget/FileUploader/FileUploader.less +0 -68
- package/dist/widget/FileUploader/FileUploader.ts +0 -156
- package/dist/widget/FileUploader/FileUploader.vue +0 -43
- package/dist/widget/HtmlEditor/HtmlEditor.d.ts +0 -70
- package/dist/widget/HtmlEditor/HtmlEditor.js +0 -287
- package/dist/widget/HtmlEditor/HtmlEditor.js.map +0 -1
- package/dist/widget/HtmlEditor/HtmlEditor.less +0 -345
- package/dist/widget/HtmlEditor/HtmlEditor.ts +0 -339
- package/dist/widget/HtmlEditor/HtmlEditor.vue +0 -70
- package/dist/widget/HtmlEditor/html-editor-HtmlSanitizer.js +0 -103
- package/dist/widget/ImageEnlarger.vue +0 -105
- package/dist/widget/OpacityBanner.vue +0 -125
- package/dist/widget/ProcessLine.vue +0 -133
- package/dist/widget/Resize.d.ts +0 -51
- package/dist/widget/Resize.js +0 -133
- package/dist/widget/Resize.js.map +0 -1
- package/dist/widget/Resize.ts +0 -152
- package/dist/widget/Resize.vue +0 -104
- package/dist/widget/TreeSelector.vue +0 -4
- package/dist/widget/calendar/BetweenDate.vue +0 -63
- package/dist/widget/calendar/Calendar.d.ts +0 -55
- package/dist/widget/calendar/Calendar.js +0 -145
- package/dist/widget/calendar/Calendar.js.map +0 -1
- package/dist/widget/calendar/Calendar.less +0 -210
- package/dist/widget/calendar/Calendar.ts +0 -167
- package/dist/widget/calendar/Calendar.vue +0 -52
- package/dist/widget/calendar/CalendarInput.vue +0 -71
- package/dist/widget/form/validator.d.ts +0 -70
- package/dist/widget/form/validator.js +0 -220
- package/dist/widget/form/validator.js.map +0 -1
- package/dist/widget/form/validator.ts +0 -289
- package/dist/widget/play-ground/sku.vue +0 -93
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 后端响应的消息
|
|
3
|
+
*/
|
|
4
|
+
declare interface RepsonseResult {
|
|
5
|
+
/**
|
|
6
|
+
* 操作代码
|
|
7
|
+
*/
|
|
8
|
+
code?: number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 操作是否成功
|
|
12
|
+
*/
|
|
13
|
+
status: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 操作说明
|
|
17
|
+
*/
|
|
18
|
+
message: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 结果,实体,
|
|
22
|
+
*/
|
|
23
|
+
data: any;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 进行新建的时候返回的实体 id
|
|
27
|
+
*/
|
|
28
|
+
newlyId?: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 分页列表的总数
|
|
32
|
+
*/
|
|
33
|
+
total?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* JSON 接口返回的通用
|
|
38
|
+
*/
|
|
39
|
+
type JsonResponse = {
|
|
40
|
+
/**
|
|
41
|
+
* 1 = 成功,0 = 失败
|
|
42
|
+
*/
|
|
43
|
+
status: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 信息
|
|
47
|
+
*/
|
|
48
|
+
message: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 分页的总数
|
|
52
|
+
*/
|
|
53
|
+
total?: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 返回数据
|
|
57
|
+
*/
|
|
58
|
+
data: any;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 官方 API 还没提供,自己写一个
|
|
62
|
+
interface FileReaderEventTarget extends EventTarget {
|
|
63
|
+
result: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface FileReaderEvent extends Event {
|
|
67
|
+
target: FileReaderEventTarget;
|
|
68
|
+
getMessage(): string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* JSON 实体
|
|
73
|
+
*/
|
|
74
|
+
declare type JsonParam = { [key: string]: string | number | boolean | JsonParam | any[] };
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* key 和 value 都是 string 类型的 JSON 实体
|
|
78
|
+
*/
|
|
79
|
+
declare type StringJsonParam = { [key: string]: string };
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* 公共类型
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
declare type ManagedWidget = {
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 按钮事件
|
|
90
|
+
*/
|
|
91
|
+
declare type ButtonEvent = {
|
|
92
|
+
/**
|
|
93
|
+
* 按钮文本
|
|
94
|
+
*/
|
|
95
|
+
name: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* JS 事件代码
|
|
99
|
+
*/
|
|
100
|
+
event: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 数据绑定配置
|
|
105
|
+
*/
|
|
106
|
+
declare type DataBinding = {
|
|
107
|
+
/**
|
|
108
|
+
* 请求方法
|
|
109
|
+
*/
|
|
110
|
+
httpMethod?: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 请求地址
|
|
114
|
+
*/
|
|
115
|
+
url: string,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 固定参数
|
|
119
|
+
*/
|
|
120
|
+
baseParams: string,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 动态获取参数的函数
|
|
124
|
+
*/
|
|
125
|
+
beforeRequest: string;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 解析过后的请求对象
|
|
130
|
+
*/
|
|
131
|
+
type ManagedRequest = {
|
|
132
|
+
/**
|
|
133
|
+
* 请求地址
|
|
134
|
+
*/
|
|
135
|
+
url: string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 请求参数
|
|
139
|
+
*/
|
|
140
|
+
params: any;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 模型与表单共有的字段
|
|
145
|
+
*/
|
|
146
|
+
declare type BaseModel = {
|
|
147
|
+
/**
|
|
148
|
+
* 字段名、Key
|
|
149
|
+
*/
|
|
150
|
+
name: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 名称,UI 外显名称
|
|
154
|
+
*/
|
|
155
|
+
label: string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 说明
|
|
159
|
+
*/
|
|
160
|
+
comment?: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 是否必填
|
|
164
|
+
*/
|
|
165
|
+
isNull?: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 数据长度/最大长度
|
|
169
|
+
*/
|
|
170
|
+
length?: number;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 其他扩展属性
|
|
174
|
+
*/
|
|
175
|
+
ext_attribs?: any;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 模型
|
|
180
|
+
*/
|
|
181
|
+
declare type Model = BaseModel & {
|
|
182
|
+
/**
|
|
183
|
+
* 数据类型
|
|
184
|
+
*/
|
|
185
|
+
dataType?: string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 是否主键
|
|
189
|
+
*/
|
|
190
|
+
isKey?: boolean;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
*默认值
|
|
194
|
+
*/
|
|
195
|
+
defaultValue?: string | number | boolean | null;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 是否跨表字段
|
|
199
|
+
*/
|
|
200
|
+
isCrossTable?: boolean;
|
|
201
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type Entity = {
|
|
2
|
+
/**
|
|
3
|
+
* 类型
|
|
4
|
+
*/
|
|
5
|
+
type: string;
|
|
6
|
+
/**
|
|
7
|
+
* 数据长度
|
|
8
|
+
*/
|
|
9
|
+
width: number;
|
|
10
|
+
/**
|
|
11
|
+
* 是否允许为空
|
|
12
|
+
*/
|
|
13
|
+
isNotNull: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 默认值
|
|
16
|
+
*/
|
|
17
|
+
defaultValue: any;
|
|
18
|
+
/**
|
|
19
|
+
* 校验规则
|
|
20
|
+
*/
|
|
21
|
+
regexp: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* 注释说明
|
|
24
|
+
*/
|
|
25
|
+
comment: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/libs/entity.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type Entity = {
|
|
2
|
+
/**
|
|
3
|
+
* 类型
|
|
4
|
+
*/
|
|
5
|
+
type: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 数据长度
|
|
9
|
+
*/
|
|
10
|
+
width: number;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 是否允许为空
|
|
14
|
+
*/
|
|
15
|
+
isNotNull: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 默认值
|
|
19
|
+
*/
|
|
20
|
+
defaultValue: any;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 校验规则
|
|
24
|
+
*/
|
|
25
|
+
regexp: RegExp;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 注释说明
|
|
29
|
+
*/
|
|
30
|
+
comment: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* iView Table 配置字段, data 字段
|
|
3
|
+
*/
|
|
4
|
+
type TableListConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* 列定义
|
|
7
|
+
*/
|
|
8
|
+
columns: any[];
|
|
9
|
+
/**
|
|
10
|
+
* 表格数据
|
|
11
|
+
*/
|
|
12
|
+
data: any[];
|
|
13
|
+
/**
|
|
14
|
+
* 记录总数
|
|
15
|
+
*/
|
|
16
|
+
total: number;
|
|
17
|
+
/**
|
|
18
|
+
* MySQL 分页方式 start
|
|
19
|
+
*/
|
|
20
|
+
start?: number;
|
|
21
|
+
/**
|
|
22
|
+
* MySQL 分页方式 limit
|
|
23
|
+
*/
|
|
24
|
+
limit?: number;
|
|
25
|
+
/**
|
|
26
|
+
* 页码,表示第几页
|
|
27
|
+
*/
|
|
28
|
+
pageNo?: number;
|
|
29
|
+
/**
|
|
30
|
+
* 每页记录数,等同于 MySQL 分页方式 limit
|
|
31
|
+
*/
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
/**
|
|
34
|
+
* 表格处于加载中状态
|
|
35
|
+
*/
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* iView Table 配置方法
|
|
40
|
+
*/
|
|
41
|
+
type TableListMethod = {
|
|
42
|
+
/**
|
|
43
|
+
* 异步加载列表数据
|
|
44
|
+
*/
|
|
45
|
+
getData(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 打开详情 UI
|
|
48
|
+
*
|
|
49
|
+
* @param id
|
|
50
|
+
*/
|
|
51
|
+
openInfo?(id: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* 删除
|
|
54
|
+
*
|
|
55
|
+
* @param id
|
|
56
|
+
* @param index 行号
|
|
57
|
+
*/
|
|
58
|
+
deleteInfo?(id: number, index: number): void;
|
|
59
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iview-widgets.js","sourceRoot":"","sources":["../../src/libs/iview-widgets.ts"],"names":[],"mappings":"AAAA,gBAAgB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// iView 组件的配置定义
|
|
2
|
+
|
|
3
|
+
// cfg: any;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* iView Table 配置字段, data 字段
|
|
7
|
+
*/
|
|
8
|
+
type TableListConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* 列定义
|
|
11
|
+
*/
|
|
12
|
+
columns: any[];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 表格数据
|
|
16
|
+
*/
|
|
17
|
+
data: any[];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 记录总数
|
|
21
|
+
*/
|
|
22
|
+
total: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* MySQL 分页方式 start
|
|
26
|
+
*/
|
|
27
|
+
start?: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* MySQL 分页方式 limit
|
|
31
|
+
*/
|
|
32
|
+
limit?: number;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 页码,表示第几页
|
|
36
|
+
*/
|
|
37
|
+
pageNo?: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 每页记录数,等同于 MySQL 分页方式 limit
|
|
41
|
+
*/
|
|
42
|
+
pageSize?: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 表格处于加载中状态
|
|
46
|
+
*/
|
|
47
|
+
loading?: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* iView Table 配置方法
|
|
52
|
+
*/
|
|
53
|
+
type TableListMethod = {
|
|
54
|
+
/**
|
|
55
|
+
* 异步加载列表数据
|
|
56
|
+
*/
|
|
57
|
+
getData(): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 打开详情 UI
|
|
61
|
+
*
|
|
62
|
+
* @param id
|
|
63
|
+
*/
|
|
64
|
+
openInfo?(id: number): void;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 删除
|
|
68
|
+
*
|
|
69
|
+
* @param id
|
|
70
|
+
* @param index 行号
|
|
71
|
+
*/
|
|
72
|
+
deleteInfo?(id: number, index: number): void;
|
|
73
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import 'view-design/dist/styles/iview.css';
|
package/dist/main.js
CHANGED
|
@@ -4,13 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const vue_1 = __importDefault(require("vue"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
require("
|
|
10
|
-
|
|
7
|
+
const index_vue_1 = __importDefault(require("./api-selector/index.vue"));
|
|
8
|
+
const index_vue_2 = __importDefault(require("./api-helper/index.vue"));
|
|
9
|
+
const view_design_1 = __importDefault(require("view-design"));
|
|
10
|
+
require("view-design/dist/styles/iview.css");
|
|
11
11
|
vue_1.default.config.productionTip = false;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
vue_1.default.use(view_design_1.default);
|
|
13
|
+
const apiSelectorFn = h => h(index_vue_1.default, {
|
|
14
|
+
props: {
|
|
15
|
+
apiRoot: 'foo'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const apiHelperFn = h => h(index_vue_2.default, {
|
|
19
|
+
props: {
|
|
20
|
+
apiRoot: 'foo'
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
new vue_1.default({ render: apiHelperFn }).$mount('#app');
|
|
16
24
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;AAAA,8CAAqB;AACrB,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;AAAA,8CAAqB;AACrB,yEAAmD;AACnD,uEAA+C;AAC/C,8DAAiC;AACjC,6CAA2C;AAE3C,aAAG,CAAC,MAAM,CAAC,aAAa,GAAG,KAAK,CAAC;AACjC,aAAG,CAAC,GAAG,CAAC,qBAAM,CAAC,CAAC;AAEhB,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAW,EAAE;IACtC,KAAK,EAAE;QACH,OAAO,EAAE,KAAK;KACjB;CACJ,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,EAAE;IAClC,KAAK,EAAE;QACH,OAAO,EAAE,KAAK;KACjB;CACJ,CAAC,CAAC;AAEH,IAAI,aAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/main.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import apiSelector from './api-selector/index.vue';
|
|
3
|
+
import apiHelper from './api-helper/index.vue';
|
|
4
|
+
import ViewUI from 'view-design';
|
|
5
|
+
import 'view-design/dist/styles/iview.css';
|
|
6
|
+
|
|
7
|
+
Vue.config.productionTip = false;
|
|
8
|
+
Vue.use(ViewUI);
|
|
9
|
+
|
|
10
|
+
const apiSelectorFn = h => h(apiSelector, {
|
|
11
|
+
props: {
|
|
12
|
+
apiRoot: 'foo'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const apiHelperFn = h => h(apiHelper, {
|
|
17
|
+
props: {
|
|
18
|
+
apiRoot: 'foo'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
new Vue({ render: apiHelperFn }).$mount('#app');
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template id="table-selector-tpl">
|
|
2
|
+
<div class="table-selector">
|
|
3
|
+
<Row style="margin:20px 0;" type="flex" justify="center" align="middle">
|
|
4
|
+
<i-Col v-if="isCrossDb" span="6" style="padding-right:10px;">
|
|
5
|
+
<i-Select placeholder="请选择数据库名" v-model="databaseName">
|
|
6
|
+
<i-Option v-for="d in databaseList" :key="d" :value="d">{{d}}</i-Option>
|
|
7
|
+
</i-Select>
|
|
8
|
+
</i-Col>
|
|
9
|
+
<i-Col :span="isCrossDb ? 6 : 12">
|
|
10
|
+
<i-Input search enter-button placeholder="按表名模糊搜索" @on-keyup="search" ref="inputEl"></i-Input>
|
|
11
|
+
</i-Col>
|
|
12
|
+
<i-Col span="12">
|
|
13
|
+
<a @click="resetData">重置</a>
|
|
14
|
+
</i-Col>
|
|
15
|
+
</Row>
|
|
16
|
+
|
|
17
|
+
<i-Table :columns="list_column" :data="data" width="100%" @on-selection-change="onSelect" max-height="300" :loading="loading" class="table-selector-table">
|
|
18
|
+
<template slot-scope="{row}" slot="select">
|
|
19
|
+
<a @click="$emit('on-select', row, databaseName)">选择</a>
|
|
20
|
+
</template>
|
|
21
|
+
</i-Table>
|
|
22
|
+
<br />
|
|
23
|
+
|
|
24
|
+
<div class="ivu-mt ivu-text-right" v-if="!isFilter">
|
|
25
|
+
<Page :total="total" :current.sync="current" show-total :page-size="pageSize" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Vue.component('table-selector', {
|
|
2
|
+
template: '#table-selector-tpl',
|
|
3
|
+
data() {
|
|
4
|
+
return {
|
|
5
|
+
// isCrossDb: false,
|
|
6
|
+
list_column: [
|
|
7
|
+
{
|
|
8
|
+
title: "#",
|
|
9
|
+
// key: 'id',
|
|
10
|
+
width: 60,
|
|
11
|
+
type: "index",
|
|
12
|
+
// type: 'selection'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: "表名",
|
|
16
|
+
key: 'tableName',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: "说明",
|
|
20
|
+
key: 'comment',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "操作",
|
|
24
|
+
slot: 'select'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
listData: [], // 显示数据
|
|
28
|
+
data: [], // 全部数据
|
|
29
|
+
total: 0,
|
|
30
|
+
current: 1,
|
|
31
|
+
pageSize: 5,
|
|
32
|
+
isFilter: false,
|
|
33
|
+
start: 0,
|
|
34
|
+
searchKeyword: "",
|
|
35
|
+
loading: false,
|
|
36
|
+
databaseList: [],
|
|
37
|
+
databaseName: "",
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
apiUrl: { type: String, required: true },
|
|
42
|
+
isCrossDb: { type: Boolean, required: true },
|
|
43
|
+
dataSourceId: { type: Number, required: true },
|
|
44
|
+
},
|
|
45
|
+
mounted() {
|
|
46
|
+
// this.isCrossDb = true;
|
|
47
|
+
// this.getData();
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
getData() {
|
|
51
|
+
this.loading = true;
|
|
52
|
+
let url = `${DS_CONFIG.API_ROOT}/admin/${this.dataSourceId}/getAllTables?start=${this.start}&limit=${this.pageSize}`;
|
|
53
|
+
|
|
54
|
+
if (this.searchKeyword)
|
|
55
|
+
url += `&tablename=${this.searchKeyword}`;
|
|
56
|
+
if (this.databaseName)
|
|
57
|
+
url += `&dbName=${this.databaseName}`;
|
|
58
|
+
|
|
59
|
+
aj.xhr.get(url, j => {
|
|
60
|
+
if (j.status) {
|
|
61
|
+
this.data = j.data;
|
|
62
|
+
this.total = j.total;
|
|
63
|
+
} else
|
|
64
|
+
this.$Message.error(j.message);
|
|
65
|
+
|
|
66
|
+
this.loading = false;
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
handleChangePageSize() {
|
|
70
|
+
let start = (this.current - 1) * this.pageSize,
|
|
71
|
+
end = start + this.pageSize;
|
|
72
|
+
|
|
73
|
+
this.listData = this.data.slice(start, end);
|
|
74
|
+
},
|
|
75
|
+
onSelect(arr) {
|
|
76
|
+
arr.forEach((item) => {
|
|
77
|
+
this.data.forEach((_item) => { });
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
resetData() {
|
|
81
|
+
this.searchKeyword = "";
|
|
82
|
+
|
|
83
|
+
this.start = 0;
|
|
84
|
+
this.getData();
|
|
85
|
+
this.$refs.inputEl.$el.querySelector("input").value = "";
|
|
86
|
+
},
|
|
87
|
+
search(ev) {
|
|
88
|
+
let input = ev.target,
|
|
89
|
+
v = input.value;
|
|
90
|
+
|
|
91
|
+
if (v) {
|
|
92
|
+
this.searchKeyword = v;
|
|
93
|
+
this.start = 0;
|
|
94
|
+
this.current = 1;
|
|
95
|
+
this.getData();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
onkeypress(ev) {
|
|
99
|
+
let input = ev.target,
|
|
100
|
+
v = input.value;
|
|
101
|
+
|
|
102
|
+
if (v) {
|
|
103
|
+
this.isFilter = true;
|
|
104
|
+
let arr = this.data.filter((item) => item.tableName.indexOf(v) != -1);
|
|
105
|
+
this.listData = arr;
|
|
106
|
+
} else {
|
|
107
|
+
this.resetData();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
watch: {
|
|
112
|
+
/**
|
|
113
|
+
* 分页
|
|
114
|
+
*
|
|
115
|
+
* @param v
|
|
116
|
+
*/
|
|
117
|
+
current(v) {
|
|
118
|
+
this.start = (v - 1) * this.pageSize;
|
|
119
|
+
this.getData();
|
|
120
|
+
},
|
|
121
|
+
dataSourceId(id) {
|
|
122
|
+
if (id) {
|
|
123
|
+
if (this.isCrossDb)
|
|
124
|
+
aj.xhr.get(`${DS_CONFIG.API_ROOT}/admin/${this.dataSourceId}/get_databases`, j => {
|
|
125
|
+
if (j.status) {
|
|
126
|
+
// 过滤 mysql 自带的库
|
|
127
|
+
let not = ['information_schema', 'performance_schema', 'sys', 'mysql'];
|
|
128
|
+
let arr = j.data.filter(db => !not.includes(db));
|
|
129
|
+
|
|
130
|
+
this.databaseList = arr;
|
|
131
|
+
|
|
132
|
+
// 默认选中第一个
|
|
133
|
+
this.start = 0;
|
|
134
|
+
this.current = 1;
|
|
135
|
+
this.databaseName = arr[0];
|
|
136
|
+
} else
|
|
137
|
+
this.$Message.error(j.message);
|
|
138
|
+
});
|
|
139
|
+
else {
|
|
140
|
+
this.databaseName = null;
|
|
141
|
+
this.getData();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
databaseName(v) {
|
|
146
|
+
this.getData(); // 会重复请求
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|