|
@@ -56,7 +56,7 @@
|
|
|
<el-form-item label="API路径" prop="path">
|
|
|
<div class="path-input-container">
|
|
|
<div class="path-prefix2">
|
|
|
- {{ originUrl }}
|
|
|
+ {{ originUrl }}/apihub/
|
|
|
</div>
|
|
|
<el-input v-model="formData.path" placeholder="请输入API路径" class="path-input" />
|
|
|
</div>
|
|
@@ -159,8 +159,8 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="SQL内容" prop="sqlContent" class="sql-content-item">
|
|
|
- <SqlEditor
|
|
|
- v-model="formData.sqlContent"
|
|
|
+ <SqlEditor
|
|
|
+ v-model="formData.sqlContent"
|
|
|
:height="300"
|
|
|
@update:modelValue="onSqlContentChange"
|
|
|
/>
|
|
@@ -623,43 +623,50 @@ const open = async (row?: any, defaultGroupKey?: string) => {
|
|
|
// 实际使用时,可能需要先调用API获取完整数据
|
|
|
// 这里模拟直接使用传入的行数据
|
|
|
const rowData = JSON.parse(JSON.stringify(row));
|
|
|
-
|
|
|
+
|
|
|
// 打印原始数据,查看后端返回的字段结构
|
|
|
console.log('编辑模式下原始数据:', rowData);
|
|
|
-
|
|
|
+
|
|
|
// 处理字段名称的映射,确保前端和后端字段名称一致
|
|
|
// 处理 ContentType 字段(可能后端是 ContentType,前端是 contentType)
|
|
|
if (rowData.ContentType !== undefined && rowData.contentType === undefined) {
|
|
|
rowData.contentType = rowData.ContentType;
|
|
|
console.log('映射 ContentType -> contentType:', rowData.contentType);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 处理 Example 字段(可能后端是 Example,前端是 example)
|
|
|
if (rowData.Example !== undefined && rowData.example === undefined) {
|
|
|
rowData.example = rowData.Example;
|
|
|
console.log('映射 Example -> example:', rowData.example);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 处理 Private 字段(可能后端是 Private,前端是 private)
|
|
|
if (rowData.Private !== undefined && rowData.private === undefined) {
|
|
|
rowData.private = rowData.Private;
|
|
|
console.log('映射 Private -> private:', rowData.private);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果没有 contentType,设置默认值
|
|
|
if (rowData.contentType === undefined || rowData.contentType === null || rowData.contentType === '') {
|
|
|
rowData.contentType = 'application/x-www-form-urlencoded';
|
|
|
console.log('设置默认 contentType:', rowData.contentType);
|
|
|
}
|
|
|
-
|
|
|
- // 如果没有 private,设置默认值
|
|
|
- if (rowData.private === undefined || rowData.private === null) {
|
|
|
+
|
|
|
+ // 处理 private 字段的数据类型,确保是数字类型
|
|
|
+ if (rowData.private !== undefined) {
|
|
|
+ // 如果是字符串,转换为数字
|
|
|
+ if (typeof rowData.private === 'string') {
|
|
|
+ rowData.private = parseInt(rowData.private, 10) || 0;
|
|
|
+ console.log('将 private 从字符串转换为数字:', rowData.private);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果没有 private,设置默认值
|
|
|
rowData.private = 0;
|
|
|
console.log('设置默认 private:', rowData.private);
|
|
|
}
|
|
|
|
|
|
Object.assign(formData, rowData);
|
|
|
-
|
|
|
+
|
|
|
// 打印最终表单数据,查看是否正确设置了这三个字段
|
|
|
console.log('最终表单数据:', {
|
|
|
contentType: formData.contentType,
|