|
@@ -44,9 +44,9 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
}, events;
|
|
|
},
|
|
|
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([ {
|
|
|
name: "",
|
|
|
typeName: "string",
|
|
@@ -61,9 +61,9 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
bindEvents: function() {},
|
|
|
onRender: function() {
|
|
|
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("创建"),
|
|
|
- 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();
|
|
|
},
|
|
|
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();
|
|
|
},
|
|
|
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());
|
|
|
},
|
|
|
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 model.name.toLowerCase();
|
|
|
})), 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));
|
|
|
}), isValidate && this.$el.find(".attributeInput").each(function(element) {
|
|
|
var attrValue = this.value.toLowerCase();
|
|
|
attrNames.indexOf(attrValue) > -1 ? (Utils.notifyInfo({
|
|
|
- content: "Attribute name already exist"
|
|
|
+ content: "属性名已存在"
|
|
|
}), $(this).addClass("errorValidate"), isAttrDuplicate && (isAttrDuplicate = !1)) : attrValue.length && attrNames.push(attrValue);
|
|
|
}), isValidate ? !isAttrDuplicate || void 0 : (Utils.notifyInfo({
|
|
|
content: "Please fill the details"
|
|
@@ -109,7 +109,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
if (!this.validateValues()) {
|
|
|
this.loaderStatus(!0);
|
|
|
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 = {
|
|
|
enumDefs: [],
|
|
|
structDefs: [],
|
|
@@ -131,7 +131,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
data: this.json,
|
|
|
success: function(model, response) {
|
|
|
var nameSpaveDef = model.businessMetadataDefs;
|
|
|
- nameSpaveDef && (that.businessMetadataDefCollection.fullCollection.add(nameSpaveDef),
|
|
|
+ nameSpaveDef && (that.businessMetadataDefCollection.fullCollection.add(nameSpaveDef),
|
|
|
Utils.notifySuccess({
|
|
|
content: "业务元数据 " + name + Messages.getAbbreviationMsg(!1, "addSuccessMessage")
|
|
|
})), that.options.onUpdateBusinessMetadata(!0);
|
|
@@ -148,8 +148,8 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
onUpdateAttr: function() {
|
|
|
var that = this, selectedBusinessMetadataClone = $.extend(!0, {}, that.selectedBusinessMetadata.toJSON()), attributeDefs = selectedBusinessMetadataClone.attributeDefs;
|
|
|
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 = {
|
|
|
enumDefs: [],
|
|
|
structDefs: [],
|
|
@@ -163,7 +163,7 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
success: function(model, response) {
|
|
|
Utils.notifySuccess({
|
|
|
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);
|
|
|
},
|
|
|
silent: !0,
|
|
@@ -179,4 +179,4 @@ define([ "require", "backbone", "hbs!tmpl/business_metadata/CreateBusinessMetada
|
|
|
}
|
|
|
});
|
|
|
return CreateBusinessMetadataLayoutView;
|
|
|
-});
|
|
|
+});
|