mirror of
https://github.com/certd/certd.git
synced 2026-04-23 11:37:23 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # ui/certd-ui/src/api/util.input.handler.js
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import _ from 'lodash-es'
|
||||
|
||||
function handleInputs (inputs) {
|
||||
if (inputs == null) {
|
||||
return
|
||||
}
|
||||
_.forEach(inputs, (item, key) => {
|
||||
if (item.component?.required === true) {
|
||||
if (item.component.rules == null) {
|
||||
item.component.rules = []
|
||||
}
|
||||
if (item.component.rules.length > 0) {
|
||||
const hasRequired = item.rules.filter(rule => {
|
||||
return rule.required === true
|
||||
})
|
||||
if (hasRequired.length > 0) {
|
||||
return
|
||||
}
|
||||
}
|
||||
item.component.rules.push({ required: true, message: '该项必填' })
|
||||
delete item.component.required
|
||||
}
|
||||
})
|
||||
}
|
||||
export default {
|
||||
|
||||
handle (list) {
|
||||
_.forEach(list, item => {
|
||||
handleInputs(item.input)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user