|
|
@@ -740,10 +740,27 @@ export default {
|
|
|
// 将对象参数传入, 进行渲染
|
|
|
getStatisOrRecord(type) {
|
|
|
this.record = type
|
|
|
- }
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取表单字段的具体控件组件实例
|
|
|
*/
|
|
|
+ getRefs(fieldName) {
|
|
|
+ let targetCom = null
|
|
|
+ // 递归遍历函数
|
|
|
+ const traverse = (component) => {
|
|
|
+ // 匹配目标组件(通过 $options.name 判断)
|
|
|
+ if (component.$props?.componentKey === fieldName) {
|
|
|
+ targetCom = component
|
|
|
+ return // 只找第一个,直接终止遍历
|
|
|
+ }
|
|
|
+ // 遍历当前组件的直接子组件
|
|
|
+ component.$children.forEach((child) => {
|
|
|
+ traverse(child)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ traverse(this)
|
|
|
+ return targetCom
|
|
|
+ }
|
|
|
// getRefsField (fieldName) {
|
|
|
// const refs = this.getRefs(fieldName)
|
|
|
// if (this.$utils.isEmpty(refs) || this.$utils.isEmpty(refs[0]) || this.$utils.isEmpty(refs[0].$refs) || this.$utils.isEmpty(refs[0].$refs['formField'])) {
|