@@ -28,7 +28,7 @@ export default function ServiceCategory() {
28
28
const { accessData } = useGlobalContext ( )
29
29
const [ loading , setLoading ] = useState < boolean > ( false )
30
30
31
- const onDrop : TreeProps [ 'onDrop' ] = info => {
31
+ const onDrop : TreeProps [ 'onDrop' ] = ( info ) => {
32
32
const dropKey = info . node . key
33
33
const dragKey = info . dragNode . key
34
34
const dropPos = info . node . pos . split ( '-' )
@@ -59,7 +59,7 @@ export default function ServiceCategory() {
59
59
60
60
if ( ! info . dropToGap ) {
61
61
// Drop on the content
62
- loop ( data , dropKey , item => {
62
+ loop ( data , dropKey , ( item ) => {
63
63
item . children = item . children || [ ]
64
64
// where to insert. New item was inserted to the start of the array in this example, but can be anywhere
65
65
item . children . unshift ( dragObj )
@@ -129,9 +129,9 @@ export default function ServiceCategory() {
129
129
const treeData = useMemo ( ( ) => {
130
130
setExpandedKeys ( [ ] )
131
131
const loop = ( data : CategorizesType [ ] ) : DataNode [ ] =>
132
- data ?. map ( item => {
132
+ data ?. map ( ( item ) => {
133
133
if ( item . children ) {
134
- setExpandedKeys ( prev => [ ...prev , item . id ] )
134
+ setExpandedKeys ( ( prev ) => [ ...prev , item . id ] )
135
135
return {
136
136
title : (
137
137
< TreeWithMore stopClick = { false } dropdownMenu = { dropdownMenu ( item as CategorizesType ) } >
@@ -169,40 +169,22 @@ export default function ServiceCategory() {
169
169
return ! checkAccess ( permission , accessData )
170
170
}
171
171
172
- const openModal = (
173
- type : 'addCate' | 'addChildCate' | 'renameCate' | 'delete' ,
174
- entity ?: CategorizesType
175
- ) => {
172
+ const openModal = ( type : 'addCate' | 'addChildCate' | 'renameCate' | 'delete' , entity ?: CategorizesType ) => {
176
173
let title : string = ''
177
174
let content : string | React . ReactNode = ''
178
175
switch ( type ) {
179
- case 'addCate' :
176
+ case 'addCate' : {
180
177
title = $t ( '添加分类' )
181
- content = (
182
- < ServiceHubCategoryConfig WithPermission = { WithPermission } ref = { addRef } type = { type } />
183
- )
178
+ content = < ServiceHubCategoryConfig ref = { addRef } type = { type } />
184
179
break
180
+ }
185
181
case 'addChildCate' :
186
182
title = $t ( '添加子分类' )
187
- content = (
188
- < ServiceHubCategoryConfig
189
- WithPermission = { WithPermission }
190
- ref = { addChildRef }
191
- type = { type }
192
- entity = { entity }
193
- />
194
- )
183
+ content = < ServiceHubCategoryConfig ref = { addChildRef } type = { type } entity = { entity } />
195
184
break
196
185
case 'renameCate' :
197
186
title = $t ( '重命名分类' )
198
- content = (
199
- < ServiceHubCategoryConfig
200
- WithPermission = { WithPermission }
201
- ref = { renameRef }
202
- type = { type }
203
- entity = { entity }
204
- />
205
- )
187
+ content = < ServiceHubCategoryConfig ref = { renameRef } type = { type } entity = { entity } />
206
188
break
207
189
case 'delete' :
208
190
title = $t ( '删除' )
@@ -215,19 +197,19 @@ export default function ServiceCategory() {
215
197
onOk : ( ) => {
216
198
switch ( type ) {
217
199
case 'addCate' :
218
- return addRef . current ?. save ( ) . then ( res => {
200
+ return addRef . current ?. save ( ) . then ( ( res ) => {
219
201
if ( res === true ) getCategoryList ( )
220
202
} )
221
203
case 'addChildCate' :
222
- return addChildRef . current ?. save ( ) . then ( res => {
204
+ return addChildRef . current ?. save ( ) . then ( ( res ) => {
223
205
if ( res === true ) getCategoryList ( )
224
206
} )
225
207
case 'renameCate' :
226
- return renameRef . current ?. save ( ) . then ( res => {
208
+ return renameRef . current ?. save ( ) . then ( ( res ) => {
227
209
if ( res === true ) getCategoryList ( )
228
210
} )
229
211
case 'delete' :
230
- return deleteCate ( entity ! ) . then ( res => {
212
+ return deleteCate ( entity ! ) . then ( ( res ) => {
231
213
if ( res === true ) getCategoryList ( )
232
214
} )
233
215
}
@@ -249,7 +231,7 @@ export default function ServiceCategory() {
249
231
method : 'DELETE' ,
250
232
eoParams : { catalogue : entity . id }
251
233
} )
252
- . then ( response => {
234
+ . then ( ( response ) => {
253
235
const { code, msg } = response
254
236
if ( code === STATUS_CODE . SUCCESS ) {
255
237
message . success ( msg || $t ( RESPONSE_TIPS . success ) )
@@ -259,14 +241,14 @@ export default function ServiceCategory() {
259
241
reject ( msg || $t ( RESPONSE_TIPS . error ) )
260
242
}
261
243
} )
262
- . catch ( errorInfo => reject ( errorInfo ) )
244
+ . catch ( ( errorInfo ) => reject ( errorInfo ) )
263
245
} )
264
246
}
265
247
266
248
const sortCategories = ( newData : CategorizesType [ ] ) => {
267
249
setLoading ( true )
268
250
fetchData < BasicResponse < null > > ( 'catalogue/sort' , { method : 'PUT' , eoBody : newData } )
269
- . then ( response => {
251
+ . then ( ( response ) => {
270
252
const { code, msg } = response
271
253
if ( code === STATUS_CODE . SUCCESS ) {
272
254
getCategoryList ( )
@@ -288,7 +270,7 @@ export default function ServiceCategory() {
288
270
fetchData < BasicResponse < { catalogues : CategorizesType [ ] ; tags : EntityItem [ ] } > > ( 'catalogues' , {
289
271
method : 'GET'
290
272
} )
291
- . then ( response => {
273
+ . then ( ( response ) => {
292
274
const { code, data, msg } = response
293
275
if ( code === STATUS_CODE . SUCCESS ) {
294
276
setGData ( data . catalogues )
@@ -308,11 +290,7 @@ export default function ServiceCategory() {
308
290
309
291
return (
310
292
< div className = "border border-solid border-BORDER p-[20px] rounded-[10px] " >
311
- < Spin
312
- indicator = { < LoadingOutlined style = { { fontSize : 24 } } spin /> }
313
- spinning = { loading }
314
- className = ""
315
- >
293
+ < Spin indicator = { < LoadingOutlined style = { { fontSize : 24 } } spin /> } spinning = { loading } className = "" >
316
294
< Tree
317
295
showIcon
318
296
draggable
0 commit comments