nsgm-cli 2.1.19 → 2.1.21
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/client/components/Button.tsx +3 -3
- package/client/components/ClientProviders.tsx +12 -12
- package/client/components/LanguageSwitcher.tsx +26 -26
- package/client/components/SSRSafeAntdProvider.tsx +7 -7
- package/client/components/SuppressHydrationWarnings.tsx +30 -30
- package/client/components/__tests__/Button.test.tsx +12 -12
- package/client/layout/index.tsx +124 -124
- package/client/redux/reducers.ts +2 -2
- package/client/redux/store.ts +24 -24
- package/client/redux/template/manage/actions.ts +40 -40
- package/client/redux/template/manage/reducers.ts +32 -32
- package/client/redux/template/manage/types.ts +19 -19
- package/client/service/template/manage.ts +29 -29
- package/client/styled/common.ts +6 -6
- package/client/styled/layout/index.ts +17 -17
- package/client/styled/template/manage.ts +19 -19
- package/client/utils/common.ts +54 -54
- package/client/utils/cookie.ts +30 -30
- package/client/utils/fetch.ts +111 -111
- package/client/utils/i18n.ts +41 -41
- package/client/utils/menu.tsx +12 -12
- package/client/utils/navigation.ts +22 -22
- package/client/utils/sso.ts +124 -124
- package/client/utils/suppressWarnings.ts +17 -17
- package/generation/prettierrc +6 -0
- package/lib/args.js +19 -19
- package/lib/cli/app.d.ts +1 -1
- package/lib/cli/app.js +2 -2
- package/lib/cli/commands/build.d.ts +1 -1
- package/lib/cli/commands/build.js +9 -9
- package/lib/cli/commands/create.d.ts +1 -1
- package/lib/cli/commands/create.js +36 -36
- package/lib/cli/commands/delete.d.ts +1 -1
- package/lib/cli/commands/delete.js +55 -55
- package/lib/cli/commands/export.d.ts +1 -1
- package/lib/cli/commands/export.js +12 -12
- package/lib/cli/commands/help.d.ts +1 -1
- package/lib/cli/commands/help.js +29 -29
- package/lib/cli/commands/init.d.ts +1 -1
- package/lib/cli/commands/init.js +31 -31
- package/lib/cli/commands/server.d.ts +1 -1
- package/lib/cli/commands/server.js +12 -12
- package/lib/cli/commands/upgrade.d.ts +1 -1
- package/lib/cli/commands/upgrade.js +13 -13
- package/lib/cli/commands/version.d.ts +1 -1
- package/lib/cli/commands/version.js +7 -7
- package/lib/cli/index.d.ts +13 -13
- package/lib/cli/parser.d.ts +1 -1
- package/lib/cli/parser.js +12 -12
- package/lib/cli/registry.d.ts +1 -1
- package/lib/cli/types.d.ts +2 -2
- package/lib/cli/utils/console.d.ts +2 -2
- package/lib/cli/utils/console.js +22 -22
- package/lib/cli/utils/index.d.ts +2 -2
- package/lib/cli/utils/prompt.d.ts +1 -1
- package/lib/cli/utils/prompt.js +98 -98
- package/lib/constants.js +28 -28
- package/lib/generate.d.ts +2 -2
- package/lib/generate.js +19 -19
- package/lib/generate_create.d.ts +1 -1
- package/lib/generate_create.js +38 -38
- package/lib/generate_delete.js +63 -63
- package/lib/generate_init.js +94 -94
- package/lib/generators/base-generator.d.ts +1 -1
- package/lib/generators/base-generator.js +23 -23
- package/lib/generators/file-generator.js +15 -15
- package/lib/generators/generator-factory.d.ts +5 -5
- package/lib/generators/i18n-generator.d.ts +1 -1
- package/lib/generators/i18n-generator.js +127 -127
- package/lib/generators/page-generator.d.ts +1 -1
- package/lib/generators/page-generator.js +25 -25
- package/lib/generators/resolver-generator.d.ts +1 -1
- package/lib/generators/resolver-generator.js +27 -27
- package/lib/generators/schema-generator.d.ts +1 -1
- package/lib/generators/schema-generator.js +4 -4
- package/lib/generators/service-generator.d.ts +1 -1
- package/lib/generators/service-generator.js +29 -29
- package/lib/generators/sql-generator.d.ts +1 -1
- package/lib/generators/sql-generator.js +10 -10
- package/lib/index.js +23 -23
- package/lib/server/csrf.d.ts +3 -3
- package/lib/server/csrf.js +20 -20
- package/lib/server/db.d.ts +1 -1
- package/lib/server/db.js +21 -21
- package/lib/server/graphql.js +26 -26
- package/lib/server/plugins/date.d.ts +1 -1
- package/lib/server/plugins/date.js +6 -6
- package/lib/server/utils/graphql-cache.js +5 -5
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/project-config.d.ts +1 -1
- package/lib/utils/project-config.js +20 -20
- package/lib/utils.js +3 -3
- package/package.json +1 -1
- package/pages/_app.tsx +62 -62
- package/pages/_document.tsx +15 -15
- package/pages/_error.tsx +26 -26
- package/pages/index.tsx +48 -48
- package/pages/login.tsx +64 -64
- package/pages/template/manage.tsx +175 -175
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as types from
|
|
1
|
+
import * as types from "./types";
|
|
2
2
|
import {
|
|
3
3
|
getTemplateService,
|
|
4
4
|
addTemplateService,
|
|
@@ -6,56 +6,56 @@ import {
|
|
|
6
6
|
deleteTemplateService,
|
|
7
7
|
searchTemplateService,
|
|
8
8
|
batchDeleteTemplateService,
|
|
9
|
-
} from
|
|
10
|
-
import { AppDispatch } from
|
|
9
|
+
} from "@/service/template/manage";
|
|
10
|
+
import { AppDispatch } from "@/redux/store";
|
|
11
11
|
|
|
12
12
|
export const getTemplate =
|
|
13
13
|
(page = 0, pageSize = 10) =>
|
|
14
14
|
(dispatch: AppDispatch) => {
|
|
15
15
|
dispatch({
|
|
16
16
|
type: types.GET_TEMPLATE,
|
|
17
|
-
})
|
|
17
|
+
});
|
|
18
18
|
|
|
19
19
|
getTemplateService(page, pageSize)
|
|
20
20
|
.then((res: any) => {
|
|
21
|
-
const { data } = res
|
|
21
|
+
const { data } = res;
|
|
22
22
|
dispatch({
|
|
23
23
|
type: types.GET_TEMPLATE_SUCCEEDED,
|
|
24
24
|
payload: {
|
|
25
25
|
template: data.template,
|
|
26
26
|
},
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
})
|
|
29
29
|
.catch(() => {
|
|
30
30
|
dispatch({
|
|
31
31
|
type: types.GET_TEMPLATE_FAILED,
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
35
|
|
|
36
36
|
export const searchTemplate =
|
|
37
37
|
(page = 0, pageSize = 10, data: any) =>
|
|
38
38
|
(dispatch: AppDispatch) => {
|
|
39
39
|
dispatch({
|
|
40
40
|
type: types.SEARCH_TEMPLATE,
|
|
41
|
-
})
|
|
41
|
+
});
|
|
42
42
|
|
|
43
43
|
searchTemplateService(page, pageSize, data)
|
|
44
44
|
.then((res: any) => {
|
|
45
|
-
const { data } = res
|
|
45
|
+
const { data } = res;
|
|
46
46
|
dispatch({
|
|
47
47
|
type: types.SEARCH_TEMPLATE_SUCCEEDED,
|
|
48
48
|
payload: {
|
|
49
49
|
template: data.templateSearch,
|
|
50
50
|
},
|
|
51
|
-
})
|
|
51
|
+
});
|
|
52
52
|
})
|
|
53
53
|
.catch(() => {
|
|
54
54
|
dispatch({
|
|
55
55
|
type: types.SEARCH_TEMPLATE_FAILED,
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
59
|
|
|
60
60
|
export const updateSSRTemplate = (template: any) => (dispatch: AppDispatch) => {
|
|
61
61
|
dispatch({
|
|
@@ -63,64 +63,64 @@ export const updateSSRTemplate = (template: any) => (dispatch: AppDispatch) => {
|
|
|
63
63
|
payload: {
|
|
64
64
|
template: template,
|
|
65
65
|
},
|
|
66
|
-
})
|
|
67
|
-
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
68
|
|
|
69
69
|
export const addTemplate = (obj: any) => (dispatch: AppDispatch) => {
|
|
70
70
|
dispatch({
|
|
71
71
|
type: types.ADD_TEMPLATE,
|
|
72
|
-
})
|
|
72
|
+
});
|
|
73
73
|
|
|
74
74
|
addTemplateService(obj)
|
|
75
75
|
.then((res: any) => {
|
|
76
|
-
const { data } = res
|
|
76
|
+
const { data } = res;
|
|
77
77
|
const template = {
|
|
78
78
|
id: data.templateAdd,
|
|
79
79
|
...obj,
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
dispatch({
|
|
82
82
|
type: types.ADD_TEMPLATE_SUCCEEDED,
|
|
83
83
|
payload: {
|
|
84
84
|
template,
|
|
85
85
|
},
|
|
86
|
-
})
|
|
86
|
+
});
|
|
87
87
|
})
|
|
88
88
|
.catch(() => {
|
|
89
89
|
dispatch({
|
|
90
90
|
type: types.ADD_TEMPLATE_FAILED,
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
94
|
|
|
95
95
|
export const modTemplate = (id: number, obj: any) => (dispatch: AppDispatch) => {
|
|
96
96
|
dispatch({
|
|
97
97
|
type: types.MOD_TEMPLATE,
|
|
98
|
-
})
|
|
98
|
+
});
|
|
99
99
|
|
|
100
100
|
updateTemplateService(id, obj)
|
|
101
101
|
.then((_res: any) => {
|
|
102
102
|
const template = {
|
|
103
103
|
id,
|
|
104
104
|
...obj,
|
|
105
|
-
}
|
|
105
|
+
};
|
|
106
106
|
dispatch({
|
|
107
107
|
type: types.MOD_TEMPLATE_SUCCEEDED,
|
|
108
108
|
payload: {
|
|
109
109
|
template,
|
|
110
110
|
},
|
|
111
|
-
})
|
|
111
|
+
});
|
|
112
112
|
})
|
|
113
113
|
.catch(() => {
|
|
114
114
|
dispatch({
|
|
115
115
|
type: types.MOD_TEMPLATE_FAILED,
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
119
|
|
|
120
120
|
export const delTemplate = (id: number) => (dispatch: AppDispatch) => {
|
|
121
121
|
dispatch({
|
|
122
122
|
type: types.DEL_TEMPLATE,
|
|
123
|
-
})
|
|
123
|
+
});
|
|
124
124
|
|
|
125
125
|
deleteTemplateService(id)
|
|
126
126
|
.then((_res: any) => {
|
|
@@ -129,19 +129,19 @@ export const delTemplate = (id: number) => (dispatch: AppDispatch) => {
|
|
|
129
129
|
payload: {
|
|
130
130
|
id,
|
|
131
131
|
},
|
|
132
|
-
})
|
|
132
|
+
});
|
|
133
133
|
})
|
|
134
134
|
.catch(() => {
|
|
135
135
|
dispatch({
|
|
136
136
|
type: types.DEL_TEMPLATE_FAILED,
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
140
|
|
|
141
141
|
export const batchDelTemplate = (ids: any) => (dispatch: AppDispatch) => {
|
|
142
142
|
dispatch({
|
|
143
143
|
type: types.BATCH_DEL_TEMPLATE,
|
|
144
|
-
})
|
|
144
|
+
});
|
|
145
145
|
|
|
146
146
|
batchDeleteTemplateService(ids)
|
|
147
147
|
.then((_res: any) => {
|
|
@@ -150,11 +150,11 @@ export const batchDelTemplate = (ids: any) => (dispatch: AppDispatch) => {
|
|
|
150
150
|
payload: {
|
|
151
151
|
ids,
|
|
152
152
|
},
|
|
153
|
-
})
|
|
153
|
+
});
|
|
154
154
|
})
|
|
155
155
|
.catch(() => {
|
|
156
156
|
dispatch({
|
|
157
157
|
type: types.BATCH_DEL_TEMPLATE_FAILED,
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
-
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as types from
|
|
2
|
-
import _ from
|
|
1
|
+
import * as types from "./types";
|
|
2
|
+
import _ from "lodash";
|
|
3
3
|
|
|
4
4
|
const initialState = {
|
|
5
5
|
firstLoadFlag: true,
|
|
@@ -7,12 +7,12 @@ const initialState = {
|
|
|
7
7
|
totalCounts: 0,
|
|
8
8
|
items: [],
|
|
9
9
|
},
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
export const templateManageReducer = (state = initialState, { type, payload }) => {
|
|
13
|
-
const { template } = state
|
|
14
|
-
const { totalCounts, items } = template
|
|
15
|
-
let newItems: any = []
|
|
13
|
+
const { template } = state;
|
|
14
|
+
const { totalCounts, items } = template;
|
|
15
|
+
let newItems: any = [];
|
|
16
16
|
|
|
17
17
|
switch (type) {
|
|
18
18
|
case types.UPDATE_SSR_TEMPLATE:
|
|
@@ -20,22 +20,22 @@ export const templateManageReducer = (state = initialState, { type, payload }) =
|
|
|
20
20
|
...state,
|
|
21
21
|
firstLoadFlag: true,
|
|
22
22
|
template: payload.template,
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
case types.GET_TEMPLATE_SUCCEEDED:
|
|
25
25
|
return {
|
|
26
26
|
...state,
|
|
27
27
|
firstLoadFlag: false,
|
|
28
28
|
template: payload.template,
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
case types.SEARCH_TEMPLATE_SUCCEEDED:
|
|
31
31
|
return {
|
|
32
32
|
...state,
|
|
33
33
|
firstLoadFlag: false,
|
|
34
34
|
template: payload.template,
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
36
|
case types.ADD_TEMPLATE_SUCCEEDED:
|
|
37
|
-
newItems = [...items]
|
|
38
|
-
newItems.push(payload.template)
|
|
37
|
+
newItems = [...items];
|
|
38
|
+
newItems.push(payload.template);
|
|
39
39
|
return {
|
|
40
40
|
...state,
|
|
41
41
|
firstLoadFlag: false,
|
|
@@ -43,17 +43,17 @@ export const templateManageReducer = (state = initialState, { type, payload }) =
|
|
|
43
43
|
totalCounts: totalCounts + 1,
|
|
44
44
|
items: newItems,
|
|
45
45
|
},
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
47
|
case types.MOD_TEMPLATE_SUCCEEDED:
|
|
48
|
-
const modItem = payload.template
|
|
48
|
+
const modItem = payload.template;
|
|
49
49
|
|
|
50
50
|
_.each(items, (item: any) => {
|
|
51
51
|
if (item.id == modItem.id) {
|
|
52
|
-
newItems.push(modItem)
|
|
52
|
+
newItems.push(modItem);
|
|
53
53
|
} else {
|
|
54
|
-
newItems.push(item)
|
|
54
|
+
newItems.push(item);
|
|
55
55
|
}
|
|
56
|
-
})
|
|
56
|
+
});
|
|
57
57
|
return {
|
|
58
58
|
...state,
|
|
59
59
|
firstLoadFlag: false,
|
|
@@ -61,15 +61,15 @@ export const templateManageReducer = (state = initialState, { type, payload }) =
|
|
|
61
61
|
totalCounts: totalCounts,
|
|
62
62
|
items: newItems,
|
|
63
63
|
},
|
|
64
|
-
}
|
|
64
|
+
};
|
|
65
65
|
case types.DEL_TEMPLATE_SUCCEEDED:
|
|
66
|
-
const delItemId = payload.id
|
|
66
|
+
const delItemId = payload.id;
|
|
67
67
|
|
|
68
68
|
_.each(items, (item: any) => {
|
|
69
69
|
if (item.id != delItemId) {
|
|
70
|
-
newItems.push(item)
|
|
70
|
+
newItems.push(item);
|
|
71
71
|
}
|
|
72
|
-
})
|
|
72
|
+
});
|
|
73
73
|
|
|
74
74
|
return {
|
|
75
75
|
...state,
|
|
@@ -78,19 +78,19 @@ export const templateManageReducer = (state = initialState, { type, payload }) =
|
|
|
78
78
|
totalCounts: totalCounts - 1,
|
|
79
79
|
items: newItems,
|
|
80
80
|
},
|
|
81
|
-
}
|
|
81
|
+
};
|
|
82
82
|
case types.BATCH_DEL_TEMPLATE_SUCCEEDED:
|
|
83
|
-
const delItemIds = payload.ids
|
|
83
|
+
const delItemIds = payload.ids;
|
|
84
84
|
const allIds = _.map(
|
|
85
|
-
_.map(items, (item) => _.pick(item, [
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
const diffIds = _.xor(allIds, delItemIds)
|
|
85
|
+
_.map(items, (item) => _.pick(item, ["id"])),
|
|
86
|
+
"id"
|
|
87
|
+
);
|
|
88
|
+
const diffIds = _.xor(allIds, delItemIds);
|
|
89
89
|
|
|
90
|
-
newItems = _.filter(items, (item: any) => _.includes(diffIds, item.id))
|
|
90
|
+
newItems = _.filter(items, (item: any) => _.includes(diffIds, item.id));
|
|
91
91
|
|
|
92
|
-
let newTotalCounts = totalCounts - delItemIds.length
|
|
93
|
-
if (newTotalCounts < 0) newTotalCounts = 0
|
|
92
|
+
let newTotalCounts = totalCounts - delItemIds.length;
|
|
93
|
+
if (newTotalCounts < 0) newTotalCounts = 0;
|
|
94
94
|
|
|
95
95
|
return {
|
|
96
96
|
...state,
|
|
@@ -99,8 +99,8 @@ export const templateManageReducer = (state = initialState, { type, payload }) =
|
|
|
99
99
|
totalCounts: newTotalCounts,
|
|
100
100
|
items: newItems,
|
|
101
101
|
},
|
|
102
|
-
}
|
|
102
|
+
};
|
|
103
103
|
default:
|
|
104
|
-
return state
|
|
104
|
+
return state;
|
|
105
105
|
}
|
|
106
|
-
}
|
|
106
|
+
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export const GET_TEMPLATE =
|
|
2
|
-
export const GET_TEMPLATE_SUCCEEDED =
|
|
3
|
-
export const GET_TEMPLATE_FAILED =
|
|
1
|
+
export const GET_TEMPLATE = "GET_TEMPLATE";
|
|
2
|
+
export const GET_TEMPLATE_SUCCEEDED = "GET_TEMPLATE_SUCCEEDED";
|
|
3
|
+
export const GET_TEMPLATE_FAILED = "GET_TEMPLATE_FAILED";
|
|
4
4
|
|
|
5
|
-
export const ADD_TEMPLATE =
|
|
6
|
-
export const ADD_TEMPLATE_SUCCEEDED =
|
|
7
|
-
export const ADD_TEMPLATE_FAILED =
|
|
5
|
+
export const ADD_TEMPLATE = "ADD_TEMPLATE";
|
|
6
|
+
export const ADD_TEMPLATE_SUCCEEDED = "ADD_TEMPLATE_SUCCEEDED";
|
|
7
|
+
export const ADD_TEMPLATE_FAILED = "ADD_TEMPLATE_FAILED";
|
|
8
8
|
|
|
9
|
-
export const MOD_TEMPLATE =
|
|
10
|
-
export const MOD_TEMPLATE_SUCCEEDED =
|
|
11
|
-
export const MOD_TEMPLATE_FAILED =
|
|
9
|
+
export const MOD_TEMPLATE = "MOD_TEMPLATE";
|
|
10
|
+
export const MOD_TEMPLATE_SUCCEEDED = "MOD_TEMPLATE_SUCCEEDED";
|
|
11
|
+
export const MOD_TEMPLATE_FAILED = "MOD_TEMPLATE_FAILED";
|
|
12
12
|
|
|
13
|
-
export const DEL_TEMPLATE =
|
|
14
|
-
export const DEL_TEMPLATE_SUCCEEDED =
|
|
15
|
-
export const DEL_TEMPLATE_FAILED =
|
|
13
|
+
export const DEL_TEMPLATE = "DEL_TEMPLATE";
|
|
14
|
+
export const DEL_TEMPLATE_SUCCEEDED = "DEL_TEMPLATE_SUCCEEDED";
|
|
15
|
+
export const DEL_TEMPLATE_FAILED = "DEL_TEMPLATE_FAILED";
|
|
16
16
|
|
|
17
|
-
export const UPDATE_SSR_TEMPLATE =
|
|
17
|
+
export const UPDATE_SSR_TEMPLATE = "UPDATE_SSR_TEMPLATE";
|
|
18
18
|
|
|
19
|
-
export const SEARCH_TEMPLATE =
|
|
20
|
-
export const SEARCH_TEMPLATE_SUCCEEDED =
|
|
21
|
-
export const SEARCH_TEMPLATE_FAILED =
|
|
19
|
+
export const SEARCH_TEMPLATE = "SEARCH_TEMPLATE";
|
|
20
|
+
export const SEARCH_TEMPLATE_SUCCEEDED = "SEARCH_TEMPLATE_SUCCEEDED";
|
|
21
|
+
export const SEARCH_TEMPLATE_FAILED = "SEARCH_TEMPLATE_FAILED";
|
|
22
22
|
|
|
23
|
-
export const BATCH_DEL_TEMPLATE =
|
|
24
|
-
export const BATCH_DEL_TEMPLATE_SUCCEEDED =
|
|
25
|
-
export const BATCH_DEL_TEMPLATE_FAILED =
|
|
23
|
+
export const BATCH_DEL_TEMPLATE = "BATCH_DEL_TEMPLATE";
|
|
24
|
+
export const BATCH_DEL_TEMPLATE_SUCCEEDED = "BATCH_DEL_TEMPLATE_SUCCEEDED";
|
|
25
|
+
export const BATCH_DEL_TEMPLATE_FAILED = "BATCH_DEL_TEMPLATE_FAILED";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getLocalGraphql } from
|
|
2
|
-
import _ from
|
|
1
|
+
import { getLocalGraphql } from "@/utils/fetch";
|
|
2
|
+
import _ from "lodash";
|
|
3
3
|
|
|
4
4
|
export const getTemplateService = (page = 0, pageSize = 10) => {
|
|
5
5
|
const getTemplateQuery = `query ($page: Int, $pageSize: Int) { template(page: $page, pageSize: $pageSize) {
|
|
@@ -7,27 +7,27 @@ export const getTemplateService = (page = 0, pageSize = 10) => {
|
|
|
7
7
|
id name
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
}
|
|
10
|
+
}`;
|
|
11
11
|
|
|
12
12
|
return getLocalGraphql(getTemplateQuery, {
|
|
13
13
|
page,
|
|
14
14
|
pageSize,
|
|
15
|
-
})
|
|
16
|
-
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
17
|
|
|
18
18
|
export const searchTemplateByIdService = (id: number) => {
|
|
19
19
|
const searchTemplateByIdQuery = `query ($id: Int) { templateGet(id: $id){
|
|
20
20
|
id name
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
}`;
|
|
23
23
|
|
|
24
24
|
return getLocalGraphql(searchTemplateByIdQuery, {
|
|
25
25
|
id,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
export const searchTemplateService = (page = 0, pageSize = 10, data: any) => {
|
|
30
|
-
const { name } = data
|
|
30
|
+
const { name } = data;
|
|
31
31
|
|
|
32
32
|
const searchTemplateQuery = `query ($page: Int, $pageSize: Int, $data: TemplateSearchInput) {
|
|
33
33
|
templateSearch(page: $page, pageSize: $pageSize, data: $data) {
|
|
@@ -35,7 +35,7 @@ export const searchTemplateService = (page = 0, pageSize = 10, data: any) => {
|
|
|
35
35
|
id name
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
}`;
|
|
39
39
|
|
|
40
40
|
return getLocalGraphql(searchTemplateQuery, {
|
|
41
41
|
page,
|
|
@@ -43,54 +43,54 @@ export const searchTemplateService = (page = 0, pageSize = 10, data: any) => {
|
|
|
43
43
|
data: {
|
|
44
44
|
name,
|
|
45
45
|
},
|
|
46
|
-
})
|
|
47
|
-
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
48
|
|
|
49
49
|
export const addTemplateService = (data: any) => {
|
|
50
|
-
const { name } = data
|
|
50
|
+
const { name } = data;
|
|
51
51
|
|
|
52
|
-
const addTemplateQuery = `mutation ($data: TemplateAddInput) { templateAdd(data: $data) }
|
|
52
|
+
const addTemplateQuery = `mutation ($data: TemplateAddInput) { templateAdd(data: $data) }`;
|
|
53
53
|
|
|
54
54
|
return getLocalGraphql(addTemplateQuery, {
|
|
55
55
|
data: {
|
|
56
56
|
name,
|
|
57
57
|
},
|
|
58
|
-
})
|
|
59
|
-
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
60
|
|
|
61
61
|
export const updateTemplateService = (id: number, data: any) => {
|
|
62
|
-
const { name } = data
|
|
62
|
+
const { name } = data;
|
|
63
63
|
|
|
64
|
-
const updateTemplateQuery = `mutation ($id: Int, $data: TemplateAddInput) { templateUpdate(id: $id, data: $data) }
|
|
64
|
+
const updateTemplateQuery = `mutation ($id: Int, $data: TemplateAddInput) { templateUpdate(id: $id, data: $data) }`;
|
|
65
65
|
|
|
66
66
|
return getLocalGraphql(updateTemplateQuery, {
|
|
67
67
|
id,
|
|
68
68
|
data: {
|
|
69
69
|
name,
|
|
70
70
|
},
|
|
71
|
-
})
|
|
72
|
-
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
73
|
|
|
74
74
|
export const deleteTemplateService = (id: number) => {
|
|
75
|
-
const deleteTemplateQuery = `mutation ($id: Int) { templateDelete(id: $id) }
|
|
75
|
+
const deleteTemplateQuery = `mutation ($id: Int) { templateDelete(id: $id) }`;
|
|
76
76
|
|
|
77
77
|
return getLocalGraphql(deleteTemplateQuery, {
|
|
78
78
|
id,
|
|
79
|
-
})
|
|
80
|
-
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
81
|
|
|
82
82
|
export const batchAddTemplateService = (datas: any) => {
|
|
83
|
-
const batchAddTemplateQuery = `mutation ($datas: [TemplateAddInput]) { templateBatchAdd(datas: $datas) }
|
|
83
|
+
const batchAddTemplateQuery = `mutation ($datas: [TemplateAddInput]) { templateBatchAdd(datas: $datas) }`;
|
|
84
84
|
|
|
85
85
|
return getLocalGraphql(batchAddTemplateQuery, {
|
|
86
86
|
datas,
|
|
87
|
-
})
|
|
88
|
-
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
89
|
|
|
90
90
|
export const batchDeleteTemplateService = (ids: any) => {
|
|
91
|
-
const batchDeleteTemplateQuery = `mutation ($ids: [Int]) { templateBatchDelete(ids: $ids) }
|
|
91
|
+
const batchDeleteTemplateQuery = `mutation ($ids: [Int]) { templateBatchDelete(ids: $ids) }`;
|
|
92
92
|
|
|
93
93
|
return getLocalGraphql(batchDeleteTemplateQuery, {
|
|
94
94
|
ids,
|
|
95
|
-
})
|
|
96
|
-
}
|
|
95
|
+
});
|
|
96
|
+
};
|
package/client/styled/common.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled, { createGlobalStyle } from
|
|
1
|
+
import styled, { createGlobalStyle } from "styled-components";
|
|
2
2
|
|
|
3
3
|
export const GlobalStyle = createGlobalStyle`
|
|
4
4
|
html,body,#__next {
|
|
@@ -6,15 +6,15 @@ export const GlobalStyle = createGlobalStyle`
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
body {
|
|
9
|
-
background-color: ${(props: any) => (props.whiteColor ?
|
|
9
|
+
background-color: ${(props: any) => (props.whiteColor ? "white" : "black")};
|
|
10
10
|
font-family: Helvetica;
|
|
11
11
|
margin: 0;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
`;
|
|
14
14
|
|
|
15
15
|
export const Container = styled.div`
|
|
16
16
|
margin: 20px;
|
|
17
|
-
|
|
17
|
+
`;
|
|
18
18
|
|
|
19
19
|
export const LoginContainer = styled.div`
|
|
20
20
|
margin: auto;
|
|
@@ -42,7 +42,7 @@ export const LoginContainer = styled.div`
|
|
|
42
42
|
height: 40px;
|
|
43
43
|
border-radius: 4px;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
`;
|
|
46
46
|
|
|
47
47
|
export const Loading = styled.div`
|
|
48
48
|
display: flex;
|
|
@@ -51,4 +51,4 @@ export const Loading = styled.div`
|
|
|
51
51
|
justify-content: center;
|
|
52
52
|
align-items: center;
|
|
53
53
|
margin-top: 100px;
|
|
54
|
-
|
|
54
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import { Layout, Menu, Breadcrumb } from
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { Layout, Menu, Breadcrumb } from "antd";
|
|
3
3
|
|
|
4
|
-
const { Header, Content, Sider } = Layout
|
|
4
|
+
const { Header, Content, Sider } = Layout;
|
|
5
5
|
|
|
6
6
|
export const Container = styled.div`
|
|
7
7
|
.main-layout {
|
|
@@ -9,14 +9,14 @@ export const Container = styled.div`
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
`;
|
|
13
13
|
|
|
14
14
|
export const FlexLayout = styled(Layout)`
|
|
15
15
|
display: flex;
|
|
16
16
|
flex: 1;
|
|
17
17
|
margin-top: 64px;
|
|
18
18
|
position: relative;
|
|
19
|
-
|
|
19
|
+
`;
|
|
20
20
|
|
|
21
21
|
export const StyledSider = styled(Sider)`
|
|
22
22
|
display: flex;
|
|
@@ -32,7 +32,7 @@ export const StyledSider = styled(Sider)`
|
|
|
32
32
|
border-right: 1px solid #e8e9ea;
|
|
33
33
|
|
|
34
34
|
&::after {
|
|
35
|
-
content:
|
|
35
|
+
content: "";
|
|
36
36
|
position: absolute;
|
|
37
37
|
top: 0;
|
|
38
38
|
right: 0;
|
|
@@ -46,13 +46,13 @@ export const StyledSider = styled(Sider)`
|
|
|
46
46
|
transparent 100%
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
`;
|
|
50
50
|
|
|
51
51
|
export const SideMenu = styled(Menu)`
|
|
52
52
|
height: 100%;
|
|
53
53
|
border-right: 0;
|
|
54
54
|
padding: 8px 0;
|
|
55
|
-
|
|
55
|
+
`;
|
|
56
56
|
|
|
57
57
|
export const ContentLayout = styled(Layout)<{ collapsed?: boolean }>`
|
|
58
58
|
display: flex;
|
|
@@ -61,11 +61,11 @@ export const ContentLayout = styled(Layout)<{ collapsed?: boolean }>`
|
|
|
61
61
|
background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
|
|
62
62
|
position: relative;
|
|
63
63
|
z-index: 1;
|
|
64
|
-
margin-left: ${(props) => (props.collapsed ?
|
|
64
|
+
margin-left: ${(props) => (props.collapsed ? "80px" : "228px")};
|
|
65
65
|
padding: 0 16px 24px;
|
|
66
66
|
min-height: 100vh;
|
|
67
67
|
transition: margin-left 0.2s ease;
|
|
68
|
-
|
|
68
|
+
`;
|
|
69
69
|
|
|
70
70
|
export const StyledHeader = styled(Header)`
|
|
71
71
|
display: flex;
|
|
@@ -88,7 +88,7 @@ export const StyledHeader = styled(Header)`
|
|
|
88
88
|
cursor: pointer;
|
|
89
89
|
|
|
90
90
|
&::before {
|
|
91
|
-
content:
|
|
91
|
+
content: "";
|
|
92
92
|
position: absolute;
|
|
93
93
|
left: -12px;
|
|
94
94
|
top: 50%;
|
|
@@ -120,7 +120,7 @@ export const StyledHeader = styled(Header)`
|
|
|
120
120
|
font-size: 28px;
|
|
121
121
|
font-weight: 800;
|
|
122
122
|
color: #fff;
|
|
123
|
-
font-family:
|
|
123
|
+
font-family: "Arial", "Microsoft YaHei", sans-serif;
|
|
124
124
|
letter-spacing: 3px;
|
|
125
125
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
126
126
|
background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
|
|
@@ -160,7 +160,7 @@ export const StyledHeader = styled(Header)`
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
`;
|
|
164
164
|
|
|
165
165
|
export const StyledBreadcrumb = styled(Breadcrumb)`
|
|
166
166
|
margin: 20px 0;
|
|
@@ -186,7 +186,7 @@ export const StyledBreadcrumb = styled(Breadcrumb)`
|
|
|
186
186
|
color: #1890ff;
|
|
187
187
|
font-weight: 600;
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
`;
|
|
190
190
|
|
|
191
191
|
export const StyledContent = styled(Content)`
|
|
192
192
|
margin: 0;
|
|
@@ -206,7 +206,7 @@ export const StyledContent = styled(Content)`
|
|
|
206
206
|
flex: 1;
|
|
207
207
|
|
|
208
208
|
&::before {
|
|
209
|
-
content:
|
|
209
|
+
content: "";
|
|
210
210
|
position: absolute;
|
|
211
211
|
top: 0;
|
|
212
212
|
left: 0;
|
|
@@ -217,7 +217,7 @@ export const StyledContent = styled(Content)`
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
&::after {
|
|
220
|
-
content:
|
|
220
|
+
content: "";
|
|
221
221
|
position: absolute;
|
|
222
222
|
top: -50%;
|
|
223
223
|
left: -50%;
|
|
@@ -259,4 +259,4 @@ export const StyledContent = styled(Content)`
|
|
|
259
259
|
border-radius: 10px 10px 0 0;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
|
|
262
|
+
`;
|