|
@@ -44,9 +44,9 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
}, events;
|
|
}, events;
|
|
},
|
|
},
|
|
initialize: function(options) {
|
|
initialize: function(options) {
|
|
- _.extend(this, _.pick(options, "businessMetadataDefCollection", "selectedBusinessMetadata", "enumDefCollection", "model", "isNewBusinessMetadata", "isAttrEdit", "typeHeaders", "attrDetails")),
|
|
|
|
- this.fromTable = !!this.isNewBusinessMetadata, this.isEditAttr = !this.isAttrEdit,
|
|
|
|
- this.businessMetadataModel = new VEntity(), this.model ? this.description = this.model.get("description") : this.create = !0,
|
|
|
|
|
|
+ _.extend(this, _.pick(options, "businessMetadataDefCollection", "selectedBusinessMetadata", "enumDefCollection", "model", "isNewBusinessMetadata", "isAttrEdit", "typeHeaders", "attrDetails")),
|
|
|
|
+ this.fromTable = !!this.isNewBusinessMetadata, this.isEditAttr = !this.isAttrEdit,
|
|
|
|
+ this.businessMetadataModel = new VEntity(), this.model ? this.description = this.model.get("description") : this.create = !0,
|
|
this.isNewBusinessMetadata ? this.collection = new Backbone.Collection() : this.collection = this.isAttrEdit ? new Backbone.Collection([ this.attrDetails ]) : new Backbone.Collection([ {
|
|
this.isNewBusinessMetadata ? this.collection = new Backbone.Collection() : this.collection = this.isAttrEdit ? new Backbone.Collection([ this.attrDetails ]) : new Backbone.Collection([ {
|
|
name: "",
|
|
name: "",
|
|
typeName: "string",
|
|
typeName: "string",
|
|
@@ -61,9 +61,9 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
bindEvents: function() {},
|
|
bindEvents: function() {},
|
|
onRender: function() {
|
|
onRender: function() {
|
|
var that = this;
|
|
var that = this;
|
|
- this.$(".fontLoader").show(), "placeholder" in HTMLInputElement.prototype || this.ui.createForm.find("input,textarea").placeholder(),
|
|
|
|
|
|
+ this.$(".fontLoader").show(), "placeholder" in HTMLInputElement.prototype || this.ui.createForm.find("input,textarea").placeholder(),
|
|
1 == this.isNewBusinessMetadata ? (that.ui.businessMetadataAttrPageOk.text("创建"),
|
|
1 == this.isNewBusinessMetadata ? (that.ui.businessMetadataAttrPageOk.text("创建"),
|
|
- that.ui.businessMetadataAttrPageOk.attr("data-action", "newBusinessMetadata")) : (that.ui.businessMetadataAttrPageOk.text("Save"),
|
|
|
|
|
|
+ that.ui.businessMetadataAttrPageOk.attr("data-action", "newBusinessMetadata")) : (that.ui.businessMetadataAttrPageOk.text("Save"),
|
|
that.ui.businessMetadataAttrPageOk.attr("data-action", "attributeEdit")), this.hideLoader();
|
|
that.ui.businessMetadataAttrPageOk.attr("data-action", "attributeEdit")), this.hideLoader();
|
|
},
|
|
},
|
|
hideLoader: function() {
|
|
hideLoader: function() {
|
|
@@ -85,7 +85,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
this.collectionAttribute(), "placeholder" in HTMLInputElement.prototype || this.ui.addAttributeDiv.find("input,textarea").placeholder();
|
|
this.collectionAttribute(), "placeholder" in HTMLInputElement.prototype || this.ui.addAttributeDiv.find("input,textarea").placeholder();
|
|
},
|
|
},
|
|
loaderStatus: function(isActive) {
|
|
loaderStatus: function(isActive) {
|
|
- isActive ? (parent.$(".business-metadata-attr-tableOverlay").show(), parent.$(".business-metadata-attr-fontLoader").show()) : (parent.$(".business-metadata-attr-tableOverlay").hide(),
|
|
|
|
|
|
+ isActive ? (parent.$(".business-metadata-attr-tableOverlay").show(), parent.$(".business-metadata-attr-fontLoader").show()) : (parent.$(".business-metadata-attr-tableOverlay").hide(),
|
|
parent.$(".business-metadata-attr-fontLoader").hide());
|
|
parent.$(".business-metadata-attr-fontLoader").hide());
|
|
},
|
|
},
|
|
validateValues: function(attributeDefs) {
|
|
validateValues: function(attributeDefs) {
|
|
@@ -93,12 +93,12 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
return attributeDefs && !this.isAttrEdit && (attrNames = _.map(attributeDefs, function(model) {
|
|
return attributeDefs && !this.isAttrEdit && (attrNames = _.map(attributeDefs, function(model) {
|
|
return model.name.toLowerCase();
|
|
return model.name.toLowerCase();
|
|
})), validationFileds.each(function(elements) {
|
|
})), validationFileds.each(function(elements) {
|
|
- $(this).removeClass("errorValidate"), "" != validationFileds[elements].value.trim() && null != validationFileds[elements].value || "none" != validationFileds[elements].style.display && ($(validationFileds[elements]).addClass("errorValidate"),
|
|
|
|
|
|
+ $(this).removeClass("errorValidate"), "" != validationFileds[elements].value.trim() && null != validationFileds[elements].value || "none" != validationFileds[elements].style.display && ($(validationFileds[elements]).addClass("errorValidate"),
|
|
$(this).addClass("errorValidate"), isValidate && (isValidate = !1));
|
|
$(this).addClass("errorValidate"), isValidate && (isValidate = !1));
|
|
}), isValidate && this.$el.find(".attributeInput").each(function(element) {
|
|
}), isValidate && this.$el.find(".attributeInput").each(function(element) {
|
|
var attrValue = this.value.toLowerCase();
|
|
var attrValue = this.value.toLowerCase();
|
|
attrNames.indexOf(attrValue) > -1 ? (Utils.notifyInfo({
|
|
attrNames.indexOf(attrValue) > -1 ? (Utils.notifyInfo({
|
|
- content: "Attribute name already exist"
|
|
|
|
|
|
+ content: "属性名已存在"
|
|
}), $(this).addClass("errorValidate"), isAttrDuplicate && (isAttrDuplicate = !1)) : attrValue.length && attrNames.push(attrValue);
|
|
}), $(this).addClass("errorValidate"), isAttrDuplicate && (isAttrDuplicate = !1)) : attrValue.length && attrNames.push(attrValue);
|
|
}), isValidate ? !isAttrDuplicate || void 0 : (Utils.notifyInfo({
|
|
}), isValidate ? !isAttrDuplicate || void 0 : (Utils.notifyInfo({
|
|
content: "Please fill the details"
|
|
content: "Please fill the details"
|
|
@@ -109,7 +109,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
if (!this.validateValues()) {
|
|
if (!this.validateValues()) {
|
|
this.loaderStatus(!0);
|
|
this.loaderStatus(!0);
|
|
var name = this.ui.name.val(), description = this.ui.description.val(), attributeObj = this.collection.toJSON();
|
|
var name = this.ui.name.val(), description = this.ui.description.val(), attributeObj = this.collection.toJSON();
|
|
- 1 === this.collection.length && "" === this.collection.first().get("name") && (attributeObj = []),
|
|
|
|
|
|
+ 1 === this.collection.length && "" === this.collection.first().get("name") && (attributeObj = []),
|
|
this.json = {
|
|
this.json = {
|
|
enumDefs: [],
|
|
enumDefs: [],
|
|
structDefs: [],
|
|
structDefs: [],
|
|
@@ -131,7 +131,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
data: this.json,
|
|
data: this.json,
|
|
success: function(model, response) {
|
|
success: function(model, response) {
|
|
var nameSpaveDef = model.businessMetadataDefs;
|
|
var nameSpaveDef = model.businessMetadataDefs;
|
|
- nameSpaveDef && (that.businessMetadataDefCollection.fullCollection.add(nameSpaveDef),
|
|
|
|
|
|
+ nameSpaveDef && (that.businessMetadataDefCollection.fullCollection.add(nameSpaveDef),
|
|
Utils.notifySuccess({
|
|
Utils.notifySuccess({
|
|
content: "业务元数据 " + name + Messages.getAbbreviationMsg(!1, "addSuccessMessage")
|
|
content: "业务元数据 " + name + Messages.getAbbreviationMsg(!1, "addSuccessMessage")
|
|
})), that.options.onUpdateBusinessMetadata(!0);
|
|
})), that.options.onUpdateBusinessMetadata(!0);
|
|
@@ -148,8 +148,8 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
onUpdateAttr: function() {
|
|
onUpdateAttr: function() {
|
|
var that = this, selectedBusinessMetadataClone = $.extend(!0, {}, that.selectedBusinessMetadata.toJSON()), attributeDefs = selectedBusinessMetadataClone.attributeDefs;
|
|
var that = this, selectedBusinessMetadataClone = $.extend(!0, {}, that.selectedBusinessMetadata.toJSON()), attributeDefs = selectedBusinessMetadataClone.attributeDefs;
|
|
if (!this.validateValues(attributeDefs)) if (this.collection.length > 0) {
|
|
if (!this.validateValues(attributeDefs)) if (this.collection.length > 0) {
|
|
- this.loaderStatus(!0), void 0 === selectedBusinessMetadataClone.attributeDefs && (selectedBusinessMetadataClone.attributeDefs = []),
|
|
|
|
- selectedBusinessMetadataClone.attributeDefs = selectedBusinessMetadataClone.attributeDefs.concat(this.collection.toJSON()),
|
|
|
|
|
|
+ this.loaderStatus(!0), void 0 === selectedBusinessMetadataClone.attributeDefs && (selectedBusinessMetadataClone.attributeDefs = []),
|
|
|
|
+ selectedBusinessMetadataClone.attributeDefs = selectedBusinessMetadataClone.attributeDefs.concat(this.collection.toJSON()),
|
|
this.json = {
|
|
this.json = {
|
|
enumDefs: [],
|
|
enumDefs: [],
|
|
structDefs: [],
|
|
structDefs: [],
|
|
@@ -163,7 +163,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
success: function(model, response) {
|
|
success: function(model, response) {
|
|
Utils.notifySuccess({
|
|
Utils.notifySuccess({
|
|
content: "一个或多个业务元数据属性" + Messages.getAbbreviationMsg(!0, "editSuccessMessage")
|
|
content: "一个或多个业务元数据属性" + Messages.getAbbreviationMsg(!0, "editSuccessMessage")
|
|
- }), model.businessMetadataDefs && model.businessMetadataDefs.length && that.selectedBusinessMetadata.set(model.businessMetadataDefs[0]),
|
|
|
|
|
|
+ }), model.businessMetadataDefs && model.businessMetadataDefs.length && that.selectedBusinessMetadata.set(model.businessMetadataDefs[0]),
|
|
that.options.onEditCallback(), that.options.onUpdateBusinessMetadata(!0);
|
|
that.options.onEditCallback(), that.options.onUpdateBusinessMetadata(!0);
|
|
},
|
|
},
|
|
silent: !0,
|
|
silent: !0,
|
|
@@ -179,4 +179,4 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
}
|
|
}
|
|
});
|
|
});
|
|
return CreateBusinessMetadataLayoutView;
|
|
return CreateBusinessMetadataLayoutView;
|
|
-});
|
|
|
|
|
|
+});
|