| | |
| | | } |
| | | |
| | | // 时间处理函数 |
| | | export function handleDatatime(value) { |
| | | export function handleDatetime(value) { |
| | | const data = new Date(value) |
| | | const month = data.getMonth() < 9 ? '0' + (data.getMonth() + 1) : data.getMonth() + 1 |
| | | const date = data.getDate() <= 9 ? '0' + data.getDate() : data.getDate() |
| | |
| | | return { RightCode: res.data[0], numvalue: res.data[1] } |
| | | } |
| | | } |
| | | |
| | | // 递归清除数组每个元素下的children为空的数组 |
| | | const clearAllChildren = (items, childrenName = 'children') => { |
| | | for (let i = 0; i < items.length; i++) { |
| | | const item = items[i] |
| | | // 当前对象存在children |
| | | if (item && item[childrenName]) { |
| | | // children为空数组时删除 |
| | | if (item[childrenName].length === 0) { |
| | | delete item[childrenName] |
| | | } else { |
| | | // 递归当前children数组 |
| | | clearAllChildren(item[childrenName], childrenName) |
| | | } |
| | | } |
| | | } |
| | | return items |
| | | } |
| | | |
| | | export default clearAllChildren |