|
|
@ -18,7 +18,7 @@ |
|
|
|
<script> |
|
|
|
import { resolveName, defaultComponentOptions } from "./utils/index"; |
|
|
|
import { reduceDefaultValue } from "./utils/defaultValue"; |
|
|
|
import { set as pathSet, get as pathGet } from "lodash"; |
|
|
|
import { set as pathSet, get as pathGet, cloneDeep } from "lodash"; |
|
|
|
|
|
|
|
import ProxyCom from "./Proxy.vue"; |
|
|
|
|
|
|
@ -163,11 +163,20 @@ export default { |
|
|
|
return components[componentKey] || components[ElComponentKey] || ElComponentKey; |
|
|
|
}, |
|
|
|
getRules(item) { |
|
|
|
// if (this.rules?.[item.key]) return this.rules[item.key]; |
|
|
|
// 自定义的没添加 |
|
|
|
|
|
|
|
// if (item.rules) return item.rules; |
|
|
|
|
|
|
|
// console.log(item.required) |
|
|
|
/** |
|
|
|
* validator 手动情况下 此方法需要改传参 ({ |
|
|
|
* // 当前总数据 |
|
|
|
* data, |
|
|
|
* // 当前字段的值 |
|
|
|
* value, |
|
|
|
* // 回调跟 el 一样 |
|
|
|
* callback, |
|
|
|
* // 当前的item config |
|
|
|
* config |
|
|
|
* }) |
|
|
|
*/ |
|
|
|
|
|
|
|
if (item.required) return [ |
|
|
|
{ |
|
|
@ -183,8 +192,8 @@ export default { |
|
|
|
}, |
|
|
|
validate() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.$refs.ElFormRef.validate((bool, data) => { |
|
|
|
if (bool) resolve(data) |
|
|
|
this.$refs.ElFormRef.validate((bool) => { |
|
|
|
if (bool) resolve(cloneDeep(this.modelFormData)) |
|
|
|
else reject() |
|
|
|
}) |
|
|
|
}) |
|
|
|