|
@@ -470,9 +470,7 @@ tools.formatDate = (now) => {
|
|
|
tools.formatDataSource = function (data) {
|
|
|
let options
|
|
|
let arr = []
|
|
|
-
|
|
|
function recursion(data) {
|
|
|
- debugger
|
|
|
let arr = []
|
|
|
data.map((item) => {
|
|
|
if (item.code && item.name)
|
|
@@ -482,15 +480,19 @@ tools.formatDataSource = function (data) {
|
|
|
})
|
|
|
return arr
|
|
|
}
|
|
|
-
|
|
|
try {
|
|
|
- options = JSON.parse(data)
|
|
|
+ if (data instanceof Array) {
|
|
|
+ options = data
|
|
|
+ } else {
|
|
|
+ options = JSON.parse(data)
|
|
|
+ }
|
|
|
if (options) {
|
|
|
return recursion(options)
|
|
|
} else {
|
|
|
return arr
|
|
|
}
|
|
|
} catch (err) {
|
|
|
+ console.log(err);
|
|
|
return arr
|
|
|
}
|
|
|
}
|