Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
defaultData = viewData.fields[viewData.current].default;
}
}
ams.resources.previewRes.fields.view = viewData;
ams.resources.previewRes.fields.view.ctx = 'view';
console.log(ams.resources.previewRes);
// ams.resource('previewRes', ams.resources.previewRes)
// 清空 ctx
ams.$blocks.form.initBlock();
this.$set(ams.$blocks.form.data, 'edit', defaultData);
this.$set(ams.$blocks.form.data, 'value', JSON.stringify(defaultData));
this.$set(ams.$blocks.form.data, 'view', defaultData);
ams.$blocks.list.initBlock();
ams.$blocks.list.data.list.forEach(item => { item.view = defaultData });
this.$set(ams.$blocks.list.data, 'list', this.copy(ams.$blocks.list.data.list));
},
}
change(code) {
console.log('change code', code);
try {
// eslint-disable-next-line no-new-func
let data = (new Function(`return ${code}`))();
ams.$blocks['$ams-config-edit'].data = data;
// console.log(data);
_this.updatePreview(data);
} catch (error) {
console.dir(error);
_this.$message.error('配置数据格式有误,请检查');
}
}
}
time = setTimeout(() => {
let data = ams.$blocks['$ams-config-edit'].data;
this.updatePreview(data);
// console.log('updateFieldDate', data);
ams.$blocks.codeForm.data.code = beautify(stringify(data), { indent_size: 2, space_in_empty_paren: true });
}, 10);
},
time = setTimeout(() => {
let data = ams.$blocks['$ams-config-edit'].data;
this.updatePreview(data);
// console.log('updateFieldDate', data);
ams.$blocks.codeForm.data.code = beautify(stringify(data), { indent_size: 2, space_in_empty_paren: true });
}, 10);
},
change(code) {
console.log('change code', code);
try {
// eslint-disable-next-line no-new-func
let data = (new Function(`return ${code}`))();
ams.$blocks['$ams-config-edit'].data = data;
// console.log(data);
_this.updatePreview(data);
} catch (error) {
console.dir(error);
_this.$message.error('配置数据格式有误,请检查');
}
}
}
setTimeout(() => {
let value = this.data.edit;
this.data.view = value;
this.data.value = JSON.stringify(value);
ams.$blocks.list.data.list.forEach(item => { item.view = value });
this.$set(ams.$blocks.list.data, 'list', _this.copy(ams.$blocks.list.data.list));
}, 0);
}
downloadFile: function () { ams.$blocks.xlsxForm.exportFile() },
uploadFile: function () { ams.$blocks.xlsxForm.importFile() }
downloadTemplate: function () { ams.$blocks.xlsxForm.exportTemplate() },
downloadFile: function () { ams.$blocks.xlsxForm.exportFile() },