free-fe-core-modules 0.0.1

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.
Files changed (112) hide show
  1. package/README.md +7 -0
  2. package/components/.gitkeep +0 -0
  3. package/components/Basic/BreadCrumbs.vue +87 -0
  4. package/components/Basic/EIcon.vue +84 -0
  5. package/components/Basic/LeveledMenus.vue +92 -0
  6. package/components/Basic/SummaryHead.vue +312 -0
  7. package/components/Dialog/BasicDialog.vue +442 -0
  8. package/components/Dialog/index.js +38 -0
  9. package/components/Dialog/index1.js +49 -0
  10. package/components/FloatingWindow/index.vue +140 -0
  11. package/components/SelectLocales/index.vue +47 -0
  12. package/components/SlidingCarousel/index.vue +86 -0
  13. package/components/SlidingNews/index.vue +138 -0
  14. package/components/StickyButtons/index.vue +98 -0
  15. package/components/ThemeSwitch/index.vue +77 -0
  16. package/field-components/Display/index.js +3 -0
  17. package/field-components/Fields/AgreementCheck.vue +161 -0
  18. package/field-components/Fields/ApiCall.vue +139 -0
  19. package/field-components/Fields/Boolean.vue +112 -0
  20. package/field-components/Fields/Category.vue +33 -0
  21. package/field-components/Fields/Check.vue +131 -0
  22. package/field-components/Fields/Customize.vue +103 -0
  23. package/field-components/Fields/Date.vue +142 -0
  24. package/field-components/Fields/DateRange.vue +199 -0
  25. package/field-components/Fields/DynamicList.vue +575 -0
  26. package/field-components/Fields/FieldEditor.vue +379 -0
  27. package/field-components/Fields/File.vue +382 -0
  28. package/field-components/Fields/FileList.vue +405 -0
  29. package/field-components/Fields/FileListCombined.vue +142 -0
  30. package/field-components/Fields/FixedList.vue +372 -0
  31. package/field-components/Fields/Image.vue +328 -0
  32. package/field-components/Fields/ImageList.vue +285 -0
  33. package/field-components/Fields/ImageListCombined.vue +76 -0
  34. package/field-components/Fields/InputFieldList.vue +299 -0
  35. package/field-components/Fields/Labels.vue +182 -0
  36. package/field-components/Fields/MixedTable.vue +367 -0
  37. package/field-components/Fields/Number.vue +247 -0
  38. package/field-components/Fields/Password.vue +79 -0
  39. package/field-components/Fields/Permission.vue +83 -0
  40. package/field-components/Fields/PermissionEditor.vue +205 -0
  41. package/field-components/Fields/QueryFilters.vue +162 -0
  42. package/field-components/Fields/RadioList.vue +81 -0
  43. package/field-components/Fields/Rich.vue +369 -0
  44. package/field-components/Fields/Search.vue +499 -0
  45. package/field-components/Fields/Select.vue +376 -0
  46. package/field-components/Fields/SelectionChain.vue +198 -0
  47. package/field-components/Fields/Separator.vue +26 -0
  48. package/field-components/Fields/SingleList.vue +125 -0
  49. package/field-components/Fields/Static.vue +22 -0
  50. package/field-components/Fields/String.vue +185 -0
  51. package/field-components/Fields/Text.vue +89 -0
  52. package/field-components/Fields/Time.vue +160 -0
  53. package/field-components/Fields/TimeRange.vue +348 -0
  54. package/field-components/Fields/UltimateFile.vue +100 -0
  55. package/field-components/Fields/Year.vue +124 -0
  56. package/field-components/Fields/YearRange.vue +188 -0
  57. package/field-components/Fields/components/FieldTypeOptions.vue +248 -0
  58. package/field-components/Fields/index.js +117 -0
  59. package/field-components/components/FieldComponents.vue +246 -0
  60. package/field-components/index.js +13 -0
  61. package/field-components/style.sass +11 -0
  62. package/free-fields/AutoHide.js +66 -0
  63. package/free-fields/CenterContent.js +15 -0
  64. package/free-fields/Draggable.js +30 -0
  65. package/free-fields/Droppable.js +114 -0
  66. package/free-fields/EditableString.js +63 -0
  67. package/free-fields/FieldCategory.js +83 -0
  68. package/free-fields/FieldTypeSelect.js +94 -0
  69. package/free-fields/fieldEditors/arrayEditor.js +3 -0
  70. package/free-fields/fieldEditors/boolEditor.js +22 -0
  71. package/free-fields/fieldEditors/dateEditor.js +23 -0
  72. package/free-fields/fieldEditors/datetimeEditor.js +23 -0
  73. package/free-fields/fieldEditors/index.js +21 -0
  74. package/free-fields/fieldEditors/jsonEditor.js +371 -0
  75. package/free-fields/fieldEditors/labeledField.js +74 -0
  76. package/free-fields/fieldEditors/numberEditor.js +51 -0
  77. package/free-fields/fieldEditors/objectEditor.js +3 -0
  78. package/free-fields/fieldEditors/selectEditor.js +0 -0
  79. package/free-fields/fieldEditors/stringEditor.js +49 -0
  80. package/free-fields/fieldEditors/textEditor.js +50 -0
  81. package/free-fields/fieldEditors/timeEditor.js +23 -0
  82. package/free-fields/index.js +402 -0
  83. package/i18n/en-us/index.js +73 -0
  84. package/i18n/fields/en-us/index.js +9 -0
  85. package/i18n/fields/zh-cn/index.js +9 -0
  86. package/i18n/zh-cn/index.js +73 -0
  87. package/index.js +367 -0
  88. package/package.json +11 -0
  89. package/router/dict/api.js +18 -0
  90. package/router/dict/data.js +48 -0
  91. package/router/dict/index.js +7 -0
  92. package/router/error/api.js +14 -0
  93. package/router/error/data.js +33 -0
  94. package/router/error/index.js +9 -0
  95. package/router/index.js +13 -0
  96. package/router/menu/api.js +24 -0
  97. package/router/menu/data.js +85 -0
  98. package/router/menu/index.js +7 -0
  99. package/router/system/api.js +10 -0
  100. package/router/system/data.js +46 -0
  101. package/router/system/index.js +7 -0
  102. package/stores/index.js +17 -0
  103. package/stores/module-mourning/actions.js +3 -0
  104. package/stores/module-mourning/getters.js +1 -0
  105. package/stores/module-mourning/index.js +11 -0
  106. package/stores/module-mourning/state.js +3 -0
  107. package/stores/mourning.js +3 -0
  108. package/view/dict/index.vue +284 -0
  109. package/view/error/list.vue +197 -0
  110. package/view/menu/index.vue +332 -0
  111. package/view/mourning/mourning.vue +45 -0
  112. package/view/system/index.vue +149 -0
package/index.js ADDED
@@ -0,0 +1,367 @@
1
+ import { date } from 'quasar';
2
+ import config from '@/config';
3
+ import MsgDialog from './components/Dialog/index';
4
+
5
+ import EIcon from './components/Basic/EIcon.vue';
6
+ import StickyButtons from './components/StickyButtons';
7
+ import SelectLocales from './components/SelectLocales';
8
+ import SummaryHead from './components/Basic/SummaryHead.vue';
9
+ import SlidingCarousel from './components/SlidingCarousel/index.vue';
10
+ import SlidingNews from './components/SlidingNews/index.vue';
11
+ import FloatingWindow from './components/FloatingWindow/index.vue';
12
+ import LeveledMenus from './components/Basic/LeveledMenus.vue';
13
+ import BreadCrumbs from './components/Basic/BreadCrumbs.vue';
14
+ import ThemeSwitch from './components/ThemeSwitch/index.vue';
15
+
16
+ import FieldComponents from './field-components';
17
+ import FreeFields from './free-fields';
18
+ import routers from './router';
19
+
20
+ // Vue.component('EIcon', () => import('./components/Basic/EIcon.vue'));
21
+ // Vue.component('StickyButtons', () => import('./components/StickyButtons'));
22
+ // Vue.component('SelectLocales', () => import('./components/SelectLocales'));
23
+ // Vue.component('SummaryHead', () => import('./components/Basic/SummaryHead.vue'));
24
+ // Vue.component('SlidingCarousel', () => import('./components/SlidingCarousel/index.vue'));
25
+ // Vue.component('SlidingNews', () => import('./components/SlidingNews/index.vue'));
26
+ // Vue.component('FloatingWindow', () => import('./components/FloatingWindow/index.vue'));
27
+ // Vue.component('LeveledMenus', () => import('./components/Basic/LeveledMenus.vue'));
28
+ // Vue.component('BreadCrumbs', () => import('./components/Basic/BreadCrumbs.vue'));
29
+ // Vue.component('ThemeSwitch', () => import('./components/ThemeSwitch/index.vue'));
30
+
31
+ // global filters
32
+ const filters = {
33
+ serverImage: url => (url ? `${config.imageUrlBase}${url}` : ''),
34
+ serverVideo: url => (url ? `${config.videoUrlBase}${url}` : ''),
35
+ serverThumb: url => (url ? `${config.thumbUrlBase}${url}` : ''),
36
+ serverDocument: url => (url ? `${config.documentUrlBase}${url}` : ''),
37
+ serverPath: (url) => {
38
+ if (!url) return '';
39
+
40
+ const dotIndex = url.lastIndexOf('.');
41
+ const ext = url.substring(dotIndex, url.length).toLowerCase();
42
+ switch (ext) {
43
+ case '.jpg':
44
+ case '.png':
45
+ case '.jpeg':
46
+ case '.bmp':
47
+ return `${config.imageUrlBase}${url}`;
48
+ case '.zip':
49
+ return `${config.zipUrlBase}${url}`;
50
+ case '.mp4':
51
+ return `${config.videoUrlBase}${url}`;
52
+ default:
53
+ return `${config.documentUrlBase}${url}`;
54
+ }
55
+ },
56
+ padding: (d, p = 2, c = '0') => {
57
+ if (!d) d = '';
58
+
59
+ for (let i = 0; i < (p - d.toString().length); i += 1) {
60
+ d = `${c}${d}`;
61
+ }
62
+
63
+ return d;
64
+ },
65
+ normalDate: (d) => {
66
+ if (!d) return '';
67
+
68
+ // compat with safari which is not supporting data format like '2020-01-01 00:00:00'
69
+ const dt = new Date(d);
70
+ const date = (!dt || !dt.valueOf()) ? new Date(d.replace(/-/g, '/')) : dt;
71
+ if (!date || !date.valueOf()) return '';
72
+
73
+ return `${date.getFullYear()}-${filters.padding((date.getMonth() || 0) + 1)}-${filters.padding((date.getDate()))}`;
74
+ },
75
+ wanYuan: (d) => {
76
+ if (!d) return 0;
77
+
78
+ const numVal = Number(d);
79
+ if (numVal) {
80
+ return (numVal / 10000.0).toFixed(2);
81
+ }
82
+
83
+ return d;
84
+ },
85
+ dateAndTime: (d) => {
86
+ if (!d) return '';
87
+
88
+ const dt = new Date(d);
89
+ const date = (!dt || !dt.valueOf()) ? new Date(d.replace(/-/g, '/')) : dt;
90
+ if (!date || !date.valueOf()) return '';
91
+
92
+ return `${date.getFullYear()}-${filters.padding((date.getMonth() || 0) + 1)}-${filters.padding((date.getDate()))} ${filters.padding(date.getHours())}:${filters.padding(date.getMinutes())}`;
93
+ },
94
+ dateYearMonth: (d, sep = '-') => {
95
+ if (!d) return '';
96
+
97
+ const dt = new Date(d);
98
+ const date = (!dt || !dt.valueOf()) ? new Date(d.replace(/-/g, '/')) : dt;
99
+ if (!date || !date.valueOf()) return '';
100
+
101
+ return `${date.getFullYear()}${sep}${filters.padding((date.getMonth() || 0) + 1)}`;
102
+ },
103
+ dateDay: (d) => {
104
+ if (!d) return '';
105
+
106
+ const dt = new Date(d);
107
+ const date = (!dt || !dt.valueOf()) ? new Date(d.replace(/-/g, '/')) : dt;
108
+ if (!date || !date.valueOf()) return '';
109
+
110
+ return filters.padding((date.getDate()));
111
+ },
112
+ ago: (d) => {
113
+ let date1 = new Date();
114
+ let date2 = new Date(d);
115
+
116
+ let diff = date.getDateDiff(date1, date2, 'seconds');
117
+ if (diff < 1) {
118
+ return diff + this.$t('justNow');
119
+ } else if (diff < 60) {
120
+ return diff + this.$t('secondsAgo');
121
+ }
122
+
123
+ diff = date.getDateDiff(date1, date2, 'minutes');
124
+ if (diff < 60) {
125
+ return diff + this.$t('minutesAgo');
126
+ }
127
+
128
+ if (diff < 24) {
129
+ return diff + this.$t('hoursAgo');
130
+ }
131
+
132
+ diff = date.getDateDiff(date1, date2, 'days');
133
+ if (diff < 31) {
134
+ return diff + this.$t('daysAgo');
135
+ }
136
+
137
+ diff = date.getDateDiff(date1, date2, 'months');
138
+ if (diff < 13) {
139
+ return diff + this.$t('monthsAgo');
140
+ }
141
+
142
+ diff = date.getDateDiff(date1, date2, 'years');
143
+ return diff + this.$t('yearsAgo');
144
+ },
145
+ };
146
+
147
+ // export default {
148
+ // config: {},
149
+ // routers: [],
150
+ // filters,
151
+ // components
152
+ // }
153
+
154
+ export default (app, root) => {
155
+ root.use(MsgDialog);
156
+
157
+ return {
158
+ config: {
159
+ backendDependencies: ["core-modules"],
160
+ dictFields: [
161
+ {
162
+ Type: "Category",
163
+ Label: "字典数据信息",
164
+ },
165
+ {
166
+ Name: "Index",
167
+ Label: "排序号",
168
+ Type: "Number",
169
+ },
170
+ {
171
+ Name: "Name",
172
+ Label: "数据名称",
173
+ Type: "String",
174
+ },
175
+ {
176
+ Name: "Label",
177
+ Label: "显示名称",
178
+ Type: "String",
179
+ },
180
+ {
181
+ Name: "Description",
182
+ Label: "说明",
183
+ Type: "Text",
184
+ },
185
+ {
186
+ Name: "Type",
187
+ Label: "类型",
188
+ Type: "Select",
189
+ Options: [
190
+ {
191
+ Label: "普通类型",
192
+ Value: "String",
193
+ },
194
+ {
195
+ Label: "文件",
196
+ Value: "File",
197
+ },
198
+ ],
199
+ },
200
+ {
201
+ Name: "Value",
202
+ Label: "值",
203
+ Type: "String",
204
+ },
205
+ {
206
+ Name: "Image",
207
+ Label: "图片/图标/文件",
208
+ Type: "File",
209
+ MaxValue: "100m",
210
+ Options: {
211
+ Dense: false,
212
+ AsLink: false,
213
+ Ext: "jpg,png,pdf,doc,docx,zip",
214
+ },
215
+ Tips: [
216
+ {
217
+ Text: "文件不可超过100M。格式支持:PNG、JPG、PDF、DOC、DOCX、ZIP。",
218
+ },
219
+ ],
220
+ },
221
+ {
222
+ Type: "Category",
223
+ Label: "高级设置",
224
+ },
225
+ {
226
+ Name: "Info",
227
+ Label: "附加信息",
228
+ Type: "Text",
229
+ },
230
+ ],
231
+ menuFields: [
232
+ {
233
+ Type: "Category",
234
+ Label: "菜单信息",
235
+ },
236
+ {
237
+ Name: "Index",
238
+ Label: "序号",
239
+ Type: "Number",
240
+ },
241
+ {
242
+ Name: "Label",
243
+ Label: "菜单名称",
244
+ Type: "String",
245
+ Required: true,
246
+ },
247
+ {
248
+ Name: "Icon",
249
+ Label: "图标",
250
+ Type: "String",
251
+ },
252
+ {
253
+ Name: "Route",
254
+ Label: "页面",
255
+ Type: "Select",
256
+ clearable: true,
257
+ Options: [],
258
+ },
259
+ {
260
+ Name: "Enabled",
261
+ Label: "启用",
262
+ Type: "Boolean",
263
+ },
264
+ {
265
+ Name: "Description",
266
+ Label: "说明",
267
+ Type: "Text",
268
+ },
269
+ {
270
+ Type: "Category",
271
+ Label: "权限配置",
272
+ },
273
+ {
274
+ Name: "Permission",
275
+ Label: "权限",
276
+ Type: "Permission",
277
+ ServiceList: "_service_list",
278
+ NoDataScope: true,
279
+ },
280
+ ],
281
+ },
282
+ routers,
283
+ filters,
284
+ components: {
285
+ EIcon,
286
+ StickyButtons,
287
+ SelectLocales,
288
+ SummaryHead,
289
+ SlidingCarousel,
290
+ SlidingNews,
291
+ FloatingWindow,
292
+ LeveledMenus,
293
+ BreadCrumbs,
294
+ ThemeSwitch,
295
+ ...FieldComponents.components,
296
+ ...FreeFields,
297
+ mourning: () => import("./view/mourning/mourning.vue"),
298
+ },
299
+ fieldComponents: FieldComponents.fieldComponents,
300
+
301
+ validators: {
302
+ validatorNotEmpty: (d) =>
303
+ d !== undefined && d.length > 0 && d.trim().length > 0,
304
+ validatorMobilePhone: (d) =>
305
+ /^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(
306
+ d
307
+ ),
308
+ validatorEmail: (d) =>
309
+ /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
310
+ d
311
+ ),
312
+ validatorPhoneOrEmail: (d) =>
313
+ d !== undefined &&
314
+ d.length > 0 &&
315
+ (this.validatorPhone(d) || this.validatorEmail(d)),
316
+ // validatorMinLength: (d, len = 0) => d !== undefined && d.length >= len,
317
+ validatorChinaIDNumber: (d) =>
318
+ /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(
319
+ d
320
+ ),
321
+ // validatorSame: (d, to) => d === to,
322
+ // validatorDifferent: (d, to) => d !== to,
323
+ // validatorGT: (d, to) => d > to,
324
+
325
+ validatorOnlyNumber: (d) => /^\d+$/.test(d),
326
+ validatorOnlyChar: (d) => /^[a-zA-Z]+$/.test(d),
327
+ validatorOnlyUpChar: (d) => /^[A-Z]+$/.test(d),
328
+ validatorOnlyLowerChar: (d) => /^[a-z]+$/.test(d),
329
+ validatorOnlyChinese: (d) => /^[\u4E00-\u9FA5]+$/.test(d),
330
+ validatorOnlyCC: (d) => /^[\u4E00-\u9FA5a-zA-Z]+$/.test(d),
331
+ validatorOnlyCCN: (d) => /^[\u4E00-\u9FA5a-zA-Z0-9]+$/.test(d),
332
+ validatorOnlyCN: (d) => /^[a-zA-Z0-9]+$/.test(d),
333
+ validatorOnlyCNU: (d) => /^[a-zA-Z0-9_]+$/.test(d),
334
+ // asdf2222.@<>_aSSS091.?<>
335
+ validatorOnlyCNS: (d) => /^[a-zA-Z0-9u4e00-u9fa5.@]+$/.test(d),
336
+
337
+ // number
338
+ validatorOnlyInteger: (d) => /^([0]|-?[1-9][0-9]+)$/.test(d.toString()),
339
+ validatorOnlyPI: (d) => /^([1-9][0-9]+)$/.test(d.toString()),
340
+ validatorOnlyPIZ: (d) => /^([0]|[1-9][0-9]+)$/.test(d.toString()),
341
+ validatorOnlyNI: (d) => /^(-[1-9][0-9]+)$/.test(d.toString()),
342
+ validatorOnlyNIZ: (d) => /^([0]|-[1-9][0-9]+)$/.test(d.toString()),
343
+
344
+ //
345
+ validatorUrl: (d) =>
346
+ /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/.test(
347
+ d
348
+ ),
349
+ validatorOfficePhone: (d) => /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}$/.test(d),
350
+ validatorChinaZip: (d) => /^[1-9]{1}(\d+){5}$/.test(d),
351
+
352
+ // password
353
+ validatorPwd0: (d) => /^.*(?=.{6,16}).*$/.test(d),
354
+ validatorPwd1: (d) => /^.{6,16}$/.test(d),
355
+ validatorPwd2: (d) =>
356
+ /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/.test(d),
357
+ validatorPwd3: (d) =>
358
+ /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\(\)]).*$/.test(
359
+ d
360
+ ),
361
+ validatorPwd4: (d) =>
362
+ /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{2,})(?=.*[a-z]{2,})(?=.*[!@#$%^&*?\(\)]).*$/.test(
363
+ d
364
+ ),
365
+ },
366
+ }
367
+ };
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "free-fe-core-modules",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "repository": "git@gitlab.com:eis-base/modules/free-fe-core-modules.git",
6
+ "author": "zhiquan",
7
+ "license": "UNLICENSED",
8
+ "dependencies": {
9
+ "@tinymce/tinymce-vue": "^5.0.0"
10
+ }
11
+ }
@@ -0,0 +1,18 @@
1
+ // import Vue from 'vue';
2
+ import { requests } from 'boot/axios';
3
+
4
+ export function getDict (p) {
5
+ return requests.getRequest('dict', p ? { Parent: p } : {});
6
+ }
7
+
8
+ export function createDict (data) {
9
+ return requests.postRequest('dict', data);
10
+ }
11
+
12
+ export function updateDict (data) {
13
+ return requests.putRequest('dict', data);
14
+ }
15
+
16
+ export function deleteDict (id) {
17
+ return requests.deleteRequest('dict', { id });
18
+ }
@@ -0,0 +1,48 @@
1
+ // import Vue from 'vue';
2
+ import {
3
+ getDict,
4
+ createDict, updateDict, deleteDict,
5
+ } from './api';
6
+
7
+ // const bus = new Vue();
8
+
9
+ const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
+
11
+ export default {
12
+ dict: () => ({
13
+ GetData: (p, l) => getDict(p).then((d) => {
14
+ const data = (d && d.data) ? d.data : {};
15
+ const currentLevel = l ? l + 1 : 1;
16
+ if (data.total) {
17
+ data.docs.forEach((o) => {
18
+ o.lazy = true;
19
+ o.level = currentLevel;
20
+ o.Info = o.Info ? JSON.stringify(o.Info) : '';
21
+ });
22
+ }
23
+
24
+ // add the extra node for each level
25
+ data.docs = data.docs || [];
26
+ data.docs.push({
27
+ addingNew: true,
28
+ id: `label_${currentLevel}_new`,
29
+ Label: `${CHINA_NUMBERS[currentLevel] || currentLevel}级`,
30
+ level: currentLevel,
31
+ Parent: p,
32
+ Index: Infinity,
33
+ });
34
+
35
+ data.docs = data.docs.sort(
36
+ (a, b) => (a ? a.Index : 0) - (b ? b.Index : 0),
37
+ );
38
+
39
+ data.total += 1;
40
+
41
+ return data;
42
+ }),
43
+ addDict: (d) => createDict(d),
44
+ editDict: (d) => updateDict(d),
45
+ deleteDict: (d) => deleteDict(d),
46
+ // Bus: bus,
47
+ }),
48
+ };
@@ -0,0 +1,7 @@
1
+ import data from './data';
2
+
3
+ export default [{
4
+ path: 'dict',
5
+ component: () => import('../../view/dict/index.vue'),
6
+ props: data.dict,
7
+ }];
@@ -0,0 +1,14 @@
1
+ // import Vue from 'vue';
2
+ import { requests } from 'boot/axios';
3
+
4
+ export function getErrorCode(o) {
5
+ return requests.getRequest('error', o);
6
+ }
7
+
8
+ export function updateErrorCode(id, msg) {
9
+ return requests.putRequest('error', { id, Message: msg });
10
+ }
11
+
12
+ export function updateDescription(id, desc) {
13
+ return requests.putRequest('error', { id, Description: desc });
14
+ }
@@ -0,0 +1,33 @@
1
+ // import Vue from 'vue';
2
+ import { getErrorCode } from './api';
3
+
4
+ // const bus = new Vue();
5
+
6
+ export default {
7
+ list: (app) => () => ({
8
+ GetData: (o) => getErrorCode(o).then((data) => {
9
+ const d = (data && data.data) ? data.data : {};
10
+
11
+ // add index
12
+ if (d && d.total) {
13
+ for (let i = 0; i < d.docs.length; i += 1) {
14
+ const dc = d.docs[i];
15
+
16
+ dc.index = (d.page - 1) * d.limit + i + 1;
17
+ }
18
+ }
19
+
20
+ d.summary = [
21
+ {
22
+ text: '代码数',
23
+ number: d.total || '0',
24
+ number_color: 'red',
25
+ icon: app.config.countIcon || 'fas fa-calculator',
26
+ },
27
+ ];
28
+
29
+ return d;
30
+ }),
31
+ // Bus: bus,
32
+ }),
33
+ };
@@ -0,0 +1,9 @@
1
+ import data from './data';
2
+
3
+ export default (app) => ([
4
+ {
5
+ path: 'errcode',
6
+ component: () => import('../../view/error/list.vue'),
7
+ props: data.list(app),
8
+ },
9
+ ]);
@@ -0,0 +1,13 @@
1
+ import dict from './dict';
2
+ import error from './error';
3
+ import system from './system';
4
+ import menu from './menu';
5
+
6
+ export default (app) => {
7
+ return [
8
+ ...dict,
9
+ ...error(app),
10
+ ...system,
11
+ ...menu,
12
+ ]
13
+ };
@@ -0,0 +1,24 @@
1
+ // import Vue from 'vue';
2
+ import { requests } from 'boot/axios';
3
+
4
+ export function getMenus(p) {
5
+ return requests.getRequest('menu', p ? {Parent: p} : {});
6
+ }
7
+
8
+ export function createMenu(data) {
9
+ if (data.CustomizeRoute) {
10
+ data.Route = data.CustomizeRoute;
11
+ }
12
+ return requests.postRequest('menu', data);
13
+ }
14
+
15
+ export function updateMenu(data) {
16
+ if (data.CustomizeRoute) {
17
+ data.Route = data.CustomizeRoute;
18
+ }
19
+ return requests.putRequest('menu', data);
20
+ }
21
+
22
+ export function deleteMenu(id) {
23
+ return requests.deleteRequest('menu', { id });
24
+ }
@@ -0,0 +1,85 @@
1
+ // import Vue from 'vue';
2
+ import {
3
+ getMenus,
4
+ createMenu, updateMenu, deleteMenu,
5
+ } from './api';
6
+
7
+ // const bus = new Vue();
8
+
9
+ const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
+
11
+ export default {
12
+ menu: () => ({
13
+ GetData: (p, n, cat) => getMenus(p).then((d) => {
14
+ const data = (d && d.data) ? d.data : {};
15
+ const currentLevel = (n && n.level) ? n.level + 1 : 1;
16
+ const menuList = [];
17
+ if (data.total) {
18
+ data.docs.forEach((o) => {
19
+ o.lazy = true;
20
+ o.level = currentLevel;
21
+
22
+ if (p) {
23
+ menuList.push(o);
24
+ } else {
25
+ const menuCat = menuList.find((m) => m.Label === o.Category);
26
+ if (menuCat) {
27
+ menuCat.children.push(o);
28
+ } else {
29
+ menuList.push({
30
+ isCategory: true,
31
+ Category: o.Category,
32
+ id: o.Category,
33
+ level: currentLevel - 1,
34
+ Label: o.Category,
35
+ children: [o],
36
+ });
37
+ }
38
+ }
39
+ });
40
+ }
41
+
42
+ // add the extra node for each level
43
+ data.docs = menuList;
44
+ if (p) {
45
+ data.docs.push({
46
+ addingNew: true,
47
+ id: `label_${currentLevel}_new`,
48
+ Label: `${CHINA_NUMBERS[currentLevel] || currentLevel}级`,
49
+ level: currentLevel,
50
+ Parent: p,
51
+ Index: Infinity,
52
+ Category: cat,
53
+ });
54
+ } else {
55
+ data.docs.forEach((doc) => {
56
+ doc.children.push({
57
+ addingNew: true,
58
+ id: `label_${currentLevel}_new`,
59
+ Label: `${CHINA_NUMBERS[currentLevel] || currentLevel}级`,
60
+ level: currentLevel,
61
+ Parent: p,
62
+ Index: Infinity,
63
+ Category: doc.Category,
64
+ });
65
+
66
+ doc.children = doc.children.sort(
67
+ (a, b) => (a ? a.Index : 0) - (b ? b.Index : 0),
68
+ );
69
+ });
70
+ }
71
+
72
+ data.docs = data.docs.sort(
73
+ (a, b) => (a ? a.Index : 0) - (b ? b.Index : 0),
74
+ );
75
+
76
+ data.total += 1;
77
+
78
+ return data;
79
+ }),
80
+ addMenu: (d) => createMenu(d),
81
+ editMenu: (d) => updateMenu(d),
82
+ deleteMenu: (d) => deleteMenu(d),
83
+ // Bus: bus,
84
+ }),
85
+ };
@@ -0,0 +1,7 @@
1
+ import data from './data';
2
+
3
+ export default [{
4
+ path: 'menu',
5
+ component: () => import('../../view/menu/index.vue'),
6
+ props: data.menu,
7
+ }];
@@ -0,0 +1,10 @@
1
+ // import Vue from 'vue';
2
+ import { requests } from 'boot/axios';
3
+
4
+ export function getConfig (p) {
5
+ return requests.getRequest('system', p ? { cat: p } : {});
6
+ }
7
+
8
+ export function updateConfig(o) {
9
+ return requests.putRequest('system', o);
10
+ }