提交 a18994fb 编写于 作者: sq3536's avatar sq3536

通用

上级 0bfe553e
......@@ -48,7 +48,7 @@ export default class AppFormJson extends Vue {
* @type {*}
* @memberof AppFormJson
*/
@Prop() public option?: any;
@Prop() public options?: any;
/**
* 当前值
......@@ -128,9 +128,8 @@ export default class AppFormJson extends Vue {
return {};
}
public getOption(): any{
let _option={
schema: this.getSchema(),
public getOptions(): any{
let _options={
theme: "bootstrap3",
iconlib: "fontawesome4",
disable_edit_json: true,
......@@ -140,14 +139,16 @@ export default class AppFormJson extends Vue {
ajax: true,
};
_options["schema"]=this.getSchema();
if (this.CurrentVal) {
_option["startval"] = JSON.parse(this.CurrentVal);
_options["startval"] = JSON.parse(this.CurrentVal);
}
if(this.option){
return Object.assign({},_option,this.option)
if(this.options){
return Object.assign({},_options,this.options)
}
return _option;
return _options;
}
/**
......@@ -162,157 +163,8 @@ export default class AppFormJson extends Vue {
this.editor.destroy();
}
let _schema = {
$ref: "#/definitions/model",
definitions: {
model: {
title: "模型",
headerTemplate: "{{ self.dataModelName }}",
type: "object",
format: "grid",
properties: {
dataModelName: {
title: "模型名",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 1,
},
objectProperties: {
title: "对象参数集合",
type: "array",
format: "tabs",
uniqueItems: true,
items: {
title: "对象",
headerTemplate: "{{ self.propertyName }}",
type: "object",
properties: {
propertyName: {
title: "对象",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 1,
},
system: {
title: "系统",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 2,
},
propertyEntity: {
title: "结构实体",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 3,
},
propertyMappings: {
title: "对象关系映射",
type: "array",
format: "table",
uniqueItems: true,
items: {
title: "映射",
type: "object",
properties: {
selfPropertyColumn: {
title: "列",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 1,
},
joinPropertyName: {
title: "关联对象",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 2,
},
joinPropertyColumn: {
title: "关联列",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 3,
},
},
},
propertyOrder: 4,
},
},
},
propertyOrder: 2,
},
nestedDataModels: {
title: "嵌套子模型集合",
type: "array",
format: "tabs",
uniqueItems: true,
items: {
title: "子模型",
$ref: "#/definitions/model",
},
propertyOrder: 3,
},
layerMappings: {
title: "模型上下级映射",
type: "array",
format: "table",
uniqueItems: true,
items: {
title: "映射",
type: "object",
properties: {
selfPropertyColumn: {
title: "列",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 1,
},
parentPropertyColumn: {
title: "父模型列",
type: "string",
options: {
grid_columns: 4,
},
propertyOrder: 2,
},
},
},
propertyOrder: 4,
},
},
},
},
};
let opt: any = {
schema: _schema,
theme: "bootstrap3",
iconlib: "fontawesome4",
disable_edit_json: true,
display_required_only: true,
disable_collapse: true,
disable_array_delete_last_row: true,
ajax: true,
};
if (this.CurrentVal) {
opt["startval"] = JSON.parse(this.CurrentVal);
}
this.editor = new JSONEditor(element, opt);
this.editor = new JSONEditor(element, _this.getOptions());
this.editor.on("change", () => {
let value = _this.editor.getValue();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册