whistle.mock-plugins 1.1.1-dev.11 → 1.1.1-dev.12
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/package.json
CHANGED
|
@@ -299,10 +299,16 @@ const InterfaceManagement = () => {
|
|
|
299
299
|
}));
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
// 处理分组值,确保它是字符串而不是数组
|
|
303
|
+
let groupValue = record.group;
|
|
304
|
+
if (Array.isArray(groupValue)) {
|
|
305
|
+
groupValue = groupValue.length > 0 ? groupValue[0] : undefined;
|
|
306
|
+
}
|
|
307
|
+
|
|
302
308
|
// 设置表单值
|
|
303
309
|
form.setFieldsValue({
|
|
304
310
|
name: record.name,
|
|
305
|
-
group:
|
|
311
|
+
group: groupValue || undefined, // 使用undefined而不是空字符串
|
|
306
312
|
pattern: record.urlPattern,
|
|
307
313
|
proxyType: record.proxyType || 'response',
|
|
308
314
|
statusCode: (record.httpStatus || record.statusCode || 200).toString(),
|
|
@@ -316,7 +322,7 @@ const InterfaceManagement = () => {
|
|
|
316
322
|
responseDelay: record.responseDelay ? record.responseDelay.toString() : '0'
|
|
317
323
|
});
|
|
318
324
|
|
|
319
|
-
console.log('编辑接口时设置的分组值:',
|
|
325
|
+
console.log('编辑接口时设置的分组值:', groupValue);
|
|
320
326
|
|
|
321
327
|
setCurrentResponseId(activeResponseId);
|
|
322
328
|
setEditingInterface(record);
|
|
@@ -377,10 +383,16 @@ const InterfaceManagement = () => {
|
|
|
377
383
|
});
|
|
378
384
|
}
|
|
379
385
|
|
|
386
|
+
// 处理分组值,确保它是字符串而不是数组
|
|
387
|
+
let groupValue = values.group;
|
|
388
|
+
if (Array.isArray(groupValue)) {
|
|
389
|
+
groupValue = groupValue.length > 0 ? groupValue[0] : '';
|
|
390
|
+
}
|
|
391
|
+
|
|
380
392
|
// 构建接口数据
|
|
381
393
|
const interfaceData = {
|
|
382
394
|
name: values.name,
|
|
383
|
-
group:
|
|
395
|
+
group: groupValue || '', // 确保group不为undefined
|
|
384
396
|
urlPattern: values.pattern,
|
|
385
397
|
proxyType: values.proxyType,
|
|
386
398
|
featureId: selectedFeatureId,
|
|
@@ -393,7 +405,7 @@ const InterfaceManagement = () => {
|
|
|
393
405
|
active: true
|
|
394
406
|
};
|
|
395
407
|
|
|
396
|
-
console.log('提交的分组值:',
|
|
408
|
+
console.log('提交的分组值:', groupValue);
|
|
397
409
|
|
|
398
410
|
// 根据代理类型添加不同字段
|
|
399
411
|
if (values.proxyType === 'redirect' || values.proxyType === 'url_redirect') {
|
|
@@ -1164,6 +1176,17 @@ const InterfaceManagement = () => {
|
|
|
1164
1176
|
showSearch
|
|
1165
1177
|
allowClear
|
|
1166
1178
|
style={{ width: '100%' }}
|
|
1179
|
+
mode="tags"
|
|
1180
|
+
maxTagCount="responsive"
|
|
1181
|
+
maxTagTextLength={10}
|
|
1182
|
+
onChange={(value) => {
|
|
1183
|
+
// 如果值是数组(tags模式),只取第一个元素
|
|
1184
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
1185
|
+
// 如果第一个元素是空字符串,则设置为undefined
|
|
1186
|
+
const groupValue = value[0] === '' ? undefined : value[0];
|
|
1187
|
+
form.setFieldsValue({ group: groupValue });
|
|
1188
|
+
}
|
|
1189
|
+
}}
|
|
1167
1190
|
onInputKeyDown={(e) => {
|
|
1168
1191
|
// 防止回车键提交表单
|
|
1169
1192
|
if (e.key === 'Enter') {
|