|
@@ -64,9 +64,9 @@
|
|
|
<el-form-item label="所属分组" prop="groupKey">
|
|
|
<el-cascader v-model="formData.groupKey" :options="groupOptions" :props="{ checkStrictly: true, emitPath: false, value: 'GroupKey', label: 'Name', children: 'Children' }" placeholder="请选择所属分组" clearable style="width: 100%" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="版本" prop="version">
|
|
|
+ <!-- <el-form-item label="版本" prop="version">
|
|
|
<el-input v-model="formData.version" placeholder="请输入版本号,如1.0" />
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
<!-- <el-form-item label="状态" prop="status">
|
|
|
<el-select v-model="formData.status" placeholder="请选择状态">
|
|
|
<el-option label="草稿" value="Draft"></el-option>
|
|
@@ -622,8 +622,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) {
|
|
|
+ rowData.private = 0;
|
|
|
+ console.log('设置默认 private:', rowData.private);
|
|
|
+ }
|
|
|
|
|
|
- Object.assign(formData, JSON.parse(JSON.stringify(row)));
|
|
|
+ Object.assign(formData, rowData);
|
|
|
+
|
|
|
+ // 打印最终表单数据,查看是否正确设置了这三个字段
|
|
|
+ console.log('最终表单数据:', {
|
|
|
+ contentType: formData.contentType,
|
|
|
+ example: formData.example,
|
|
|
+ private: formData.private
|
|
|
+ });
|
|
|
|
|
|
// 确保参数数组存在
|
|
|
if (!formData.parameters) {
|