Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-easy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
easyUI
hls-easy-ui
Commits
83114aeb
Commit
83114aeb
authored
Sep 19, 2024
by
王纵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
低代码表单保存时增加父表ID
parent
8baea3e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
13 deletions
+35
-13
index.vue
src/Dynamic/ConfigRenderComponent/DForm/index.vue
+35
-13
No files found.
src/Dynamic/ConfigRenderComponent/DForm/index.vue
View file @
83114aeb
...
...
@@ -2,7 +2,7 @@
* @Author: zong.wang01@hand-china.com
* @Date: 2024-07-29 10:51:56
* @LastEditors: zong.wang01@hand-china.com
* @LastEditTime: 2024-09-
06 15:14:45
* @LastEditTime: 2024-09-
19 15:57:20
* @Version: 1.0.0
* @Description: 表单渲染
* @Copyright: Copyright (c) 2021, Hand-RongJing
...
...
@@ -228,17 +228,7 @@ export default {
}
if
(
this
.
formType
===
'normal'
)
{
this
.
addRef
(
this
,
this
.
tabInfo
.
tabCode
);
//正常表单保存表单组件实例,供页面整体保存时使用
if
(
this
.
tabInfo
.
readUrl
)
{
// console.log('D-form-activated', this.tabInfo.readUrl, JSON.stringify(this.queryParams))
const
res
=
await
getFormData
(
this
.
tabInfo
.
readUrl
,
this
.
queryParams
)
this
.
fieldsObj
=
res
.
content
.
length
?
res
.
content
[
0
]
:
{};
this
.
dataLoadHandle
(
this
.
fieldsObj
,
this
.
tabInfo
.
tabCode
);
// 数据查询后的回调
this
.
setDataSetData
(
this
.
tabInfo
.
tabCode
,
{...
this
.
fieldsObj
});
// 保存一份原始数据
this
.
status
=
res
.
content
.
length
?
'update'
:
'create'
;
}
else
{
this
.
status
=
'create'
;
}
await
this
.
loadData
();
}
this
.
formatFieldsValue
();
},
...
...
@@ -264,6 +254,17 @@ export default {
})
this
.
originFieldsObj
=
{...
this
.
fieldsObj
};
},
async
loadData
()
{
if
(
this
.
tabInfo
.
readUrl
)
{
const
res
=
await
getFormData
(
this
.
tabInfo
.
readUrl
,
this
.
queryParams
)
this
.
fieldsObj
=
res
.
content
.
length
?
res
.
content
[
0
]
:
{};
this
.
dataLoadHandle
(
this
.
fieldsObj
,
this
.
tabInfo
.
tabCode
);
// 数据查询后的回调
this
.
setDataSetData
(
this
.
tabInfo
.
tabCode
,
{...
this
.
fieldsObj
});
// 保存一份原始数据
this
.
status
=
res
.
content
.
length
?
'update'
:
'create'
;
}
else
{
this
.
status
=
'create'
;
}
},
getInputType
(
type
)
{
if
(
type
===
'TextArea'
)
{
return
'textarea'
;
...
...
@@ -322,8 +323,9 @@ export default {
}
formValues
[
item
.
columnName
]
=
values
[
item
.
columnName
];
});
const
parentId
=
this
.
status
===
'create'
?
this
.
getParentPrimaryKey
()
:
{};
const
result
=
{
allValues
:
{...
values
,
_status
:
this
.
status
},
// 完整的数据,包含record或者接口查询的所有字段信息
allValues
:
{...
values
,
...
parentId
,
_status
:
this
.
status
},
// 完整的数据,包含record或者接口查询的所有字段信息
formValues
:
{...
formValues
,
_status
:
this
.
status
}
// 只包含配置的fileds信息
}
resolve
(
result
);
...
...
@@ -332,6 +334,26 @@ export default {
});
});
},
getParentPrimaryKey
()
{
if
(
this
.
formType
===
'normal'
)
{
const
{
baseTable
,
parentTable
}
=
this
.
tabInfo
;
const
dataSetsObj
=
this
.
dynamicInfo
().
dataSetObject
;
const
dataSetlist
=
Object
.
values
(
dataSetsObj
);
if
(
baseTable
!==
parentTable
)
{
const
{
parentDataSetName
}
=
dataSetsObj
[
this
.
tabInfo
.
tabCode
];
if
(
parentDataSetName
)
{
const
config
=
dataSetlist
.
find
(
o
=>
o
.
dataSetName
===
parentDataSetName
)
||
{};
if
(
config
.
instanceRef
)
{
const
val
=
config
.
instanceRef
.
getFieldsValue
();
return
{
[
config
.
primaryKey
]:
val
[
config
.
primaryKey
]
};
}
}
}
}
return
{};
},
reset
()
{
this
.
fieldsObj
=
{...
this
.
originFieldsObj
};
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment