代码整理

qianlishi 2 years ago
parent ee83bad2e9
commit 4117fce4df

@ -134,7 +134,6 @@ export default {
hasOwn(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key)
},
isNotBlank(val) {
return !this.isBlank(val)
},
@ -291,6 +290,9 @@ export default {
return Object.prototype.toString.call(value) === "[object Array]";
}
},
isObjectFn(value) {
return Object.prototype.toString.call(value) === "[object Array]";
},
urlEncode(val) {
return encodeURIComponent(val)
},

@ -570,11 +570,11 @@ export default {
for (const key in data.setup) {
for (let i = 0; i < option.setup.length; i++) {
let item = option.setup[i];
if (Object.prototype.toString.call(item) == "[object Object]") {
if (this.isObjectFn(item)) {
if (key == option.setup[i].name) {
option.setup[i].value = data.setup[key];
}
} else if (Object.prototype.toString.call(item) == "[object Array]") {
} else if (this.isArrayFn(item)) {
for (let j = 0; j < item.length; j++) {
const list = item[j].list;
list.forEach((el) => {
@ -696,17 +696,16 @@ export default {
},
//
handleDefaultValue(widgetJson) {
console.log(widgetJson);
for (const key in widgetJson) {
if (key == "options") {
// collapsedatapositionsetup
// setup
for (let i = 0; i < widgetJson.options.setup.length; i++) {
const item = widgetJson.options.setup[i];
if (Object.prototype.toString.call(item) == "[object Object]") {
if (this.isObjectFn(item)) {
widgetJson.value.setup[item.name] = item.value;
} else if (
Object.prototype.toString.call(item) == "[object Array]"
) {
} else if (this.isArrayFn(item)) {
for (let j = 0; j < item.length; j++) {
const list = item[j].list;
list.forEach((el) => {
@ -827,15 +826,13 @@ export default {
},
setDefaultValue(options, val) {
for (let i = 0; i < options.length; i++) {
if (Object.prototype.toString.call(options[i]) == "[object Object]") {
if (this.isObjectFn(options[i])) {
for (const k in val) {
if (options[i].name == k) {
options[i].value = val[k];
}
}
} else if (
Object.prototype.toString.call(options[i]) == "[object Array]"
) {
} else if (this.isArrayFn(options[i])) {
for (let j = 0; j < options[i].length; j++) {
const list = options[i][j].list;
for (let z = 0; z < list.length; z++) {

Loading…
Cancel
Save