File tree 4 files changed +22
-4
lines changed
4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ const mock = {
161
161
create : config => createAPI ( '/mock/create' , 'post' , config ) ,
162
162
update : config => createAPI ( '/mock/update' , 'post' , config ) ,
163
163
delete : config => createAPI ( '/mock/delete' , 'post' , config ) ,
164
- export : config => createExportForm ( '/mock/export' , config )
164
+ export : config => createExportForm ( '/api/ mock/export' , config )
165
165
}
166
166
167
167
const group = {
Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ export default {
106
106
create : 'Create Success' ,
107
107
update : 'Update Success' ,
108
108
delete : '{name} is deleted'
109
+ } ,
110
+ error : {
111
+ groupIsNull : 'Please select the project belongs to'
109
112
}
110
113
} ,
111
114
formatError : 'File only supports JSON/YML format' ,
Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ export default {
106
106
create : '创建成功' ,
107
107
update : '更新成功' ,
108
108
delete : '{name} 已删除'
109
+ } ,
110
+ error : {
111
+ groupIsNull : '请选择项目归属'
109
112
}
110
113
} ,
111
114
formatError : '文件仅支持 JSON/YML 格式' ,
Original file line number Diff line number Diff line change @@ -170,8 +170,11 @@ export default {
170
170
this .form .groupId = proj .user ._id
171
171
}
172
172
} else {
173
- this .fetchGroup ()
174
- this .form .groupId = this .user .id
173
+ this .fetchGroup ().then (groups => {
174
+ if (groups .length < 2 ) {
175
+ this .form .groupId = this .user .id
176
+ }
177
+ })
175
178
}
176
179
},
177
180
computed: {
@@ -218,7 +221,7 @@ export default {
218
221
: newUrl .replace (/ \/\/ / g , ' /' ).replace (/ \/ $ / , ' ' )
219
222
},
220
223
fetchGroup () {
221
- api .group .getList ().then ((res ) => {
224
+ return api .group .getList ().then ((res ) => {
222
225
if (res .data .success ) {
223
226
this .groups = [{ value: this .user .id , label: this .user .nickName }].concat (
224
227
res .data .data .map (o => ({
@@ -227,6 +230,7 @@ export default {
227
230
}))
228
231
)
229
232
}
233
+ return this .groups
230
234
})
231
235
},
232
236
submit () {
@@ -249,6 +253,14 @@ export default {
249
253
}
250
254
})
251
255
} else {
256
+ if (this .form .groupId === ' ' ) {
257
+ this .$Message .error ({
258
+ content: this .$t (' p.new.form.error.groupIsNull' ),
259
+ duration: 5
260
+ })
261
+ return
262
+ }
263
+
252
264
if (data .group === this .user .id ) {
253
265
data .group = ' '
254
266
}
You can’t perform that action at this time.
0 commit comments